free指令是監控Linux記憶體使用最常用的指令,可以顯示目前系統未使用的和已使用的記憶體數目,還可以顯示被核心使用的記憶體緩沖區。
文法選項
-b:以Byte為機關顯示記憶體使用情況;
-k:以KB為機關顯示記憶體使用情況;
-m:以MB為機關顯示記憶體使用情況;
-o:不顯示緩沖區調節列;
-s<間隔秒數>:持續觀察記憶體使用狀況;
-t:顯示記憶體總和列;
-V:顯示版本資訊。
執行個體
[root@xiesshavip002 ~]# free
total used free shared buff/cache available
Mem: 1016904 76300 669468 288 271136 810556
Swap: 0 0 0
[root@xiesshavip002 ~]#
total:記憶體總數;
used:已經使用的記憶體數;
free:空閑的記憶體數;
shared:目前已經廢棄不用;
buffers Buffer:緩存記憶體數;
cached Page:緩存記憶體數。
free --help
[root@xiesshavip002 ~]# free --help
Usage:
free [options]
Options:
-b, --bytes show output in bytes
-k, --kilo show output in kilobytes
-m, --mega show output in megabytes
-g, --giga show output in gigabytes
--tera show output in terabytes
-h, --human show human-readable output
--si use powers of 1000 not 1024
-l, --lohi show detailed low and high memory statistics
-t, --total show total for RAM + swap
-s N, --seconds N repeat printing every N seconds
-c N, --count N repeat printing N times, then exit
-w, --wide wide output
--help display this help and exit
-V, --version output version information and exit
For more details see free(1).
[root@xiesshavip002 ~]#