free 功能说明:查看系统内存信息
free命令用于显示系统内存状态,具体包括系统物理内存、虚拟内存、共享内存和系统缓存等。
参数选项
-b 以Byte为单位显示内存的使用情况
-m 以MB为单位显示内存的使用情况
-k 以KB为单位显示内存的使用情况
-h 以人类可读的形式显示内存的使用情况*
-t 显示内存总和列
-s <间隔秒数> 根据指定的间隔秒数持续显示内存的使用情况端
-o 不显示系统缓冲区列
[root@testdb62 ~]# free #<==不加参数默认显示的是KB为单位,很难读懂
total used free shared buff/cache available
Mem: 8173976 1134528 2362700 66676 4676748 6666784
Swap: 8257532 0 8257532
[root@testdb62 ~]# free -k
total used free shared buff/cache available
Mem: 8173976 1134292 2362916 66676 4676768 6667020
Swap: 8257532 0 8257532
[root@testdb62 ~]# free -m
total used free shared buff/cache available
Mem: 7982 1107 2307 65 4567 6510
Swap: 8063 0 8063
[root@testdb62 ~]# free -h
total used free shared buff/cache available
Mem: 7.8G 1.1G 2.3G 65M 4.5G 6.4G
Swap: 7.9G 0B 7.9G
针对上面的输出,有以下说明。
Linux系统的特性是将不用的物理内存缓存起来,因此2.3G不是系统的真实剩余内存。
系统真正可用的内存为6.4GG。
buffers为写入数据缓冲区。
cache为读取数据的缓存区。