free命令可以显示Linux系统中空闲的、已用的物理内存及swap内存,及被内核使用的buffer。
[email protected]:~$ free -h
total used free shared buff/cache available
Mem: 3.8G 1.3G 928M 27M 1.7G 2.2G
Swap: 4.0G 0B 4.0G
total:Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
used:Used memory (calculated as total - free - buffers - cache)
free:Unused memory (MemFree and SwapFree in /proc/meminfo)
shared:Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on kernels 2.6.32, displayed as zero if
not available)
buffers:Memory used by kernel buffers (Buffers in /proc/meminfo)
cache:Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
buff/cache:Sum of buffers and cache(A buffer is something that has yet to be "written" to disk. A cache is something that has been "read" from the disk and stored for later use.)
available:Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)