free 命令
内存查看命令
-m 按照MB大小显示内存大小
-h 在具体的数值后按照适合的单位显示
[root@localhost ~]# free
total used free shared buff/cache available
Mem: 1865276 816452 369100 11328 679724 839048
Swap: 4194300 0 4194300
#total 总内存大小
#used 使用内存
#free 剩余内存
#buff/cache 缓存内存大小
#00001(磁盘)-->内存(cache)-->cpu
#cpu-->内存(buff)-->00001(磁盘)
#total=used+free+buff/cache
#available包含free和/buff/cache剩余部分
物理空闲内存 = 总物理内存 - 实际已用内存 + 缓冲 + 缓存
应用程序可用空闲内存 = 总物理内存 - 实际已用内存
free -m
指定MB单位显示数值
[root@localhost ~]# free -m
total used free shared buff/cache available
Mem: 1821 797 360 11 663 819
Swap: 4095 0 4095
free -g
指定显示单位为GB显示数值
[root@localhost ~]# free -g
total used free shared buff/cache available
Mem: 1 0 0 0 0 0
Swap: 3 0 3
free -h
根据数值大小显示合适的单位
[root@localhost ~]# free -h
total used free shared buff/cache available
Mem: 1.8G 797M 360M 11M 663M 819M
Swap: 4.0G 0B 4.0G