Understanding output of Free command in UNIX/Linux

Actually this understanding helps when we analyze the systems which going through bad phase of perfromance.

[root@localhost ~]# free
total used free shared buffers cached
Mem: 2073636 1954072 119564 0 4004 1465796
-/+ buffers/cache: 484272 1589364
Swap: 4192956 112 4192844

Show in MB
[root@localhost ~]# free -m
total used free shared buffers cached
Mem: 2025 1807 217 0 6 1412
-/+ buffers/cache: 388 1636
Swap: 4094 0 4094

1. All the numbers are reported in 1024-byte blocks.
2. Here, we see a system with 2073636 blocks (about ~2G) of physical RAM, with 1954072 (about ~1.86 GB) currently in use.
3. The “shared” column lists the amount of physical memory shared between multiple processes. Here, we see that about 0 MB of pages are being shared (I suspect it is not a good sign; memory is not being utilized well however on maximum number of servers I’ve observed the same thing).
4. The “buffers” column shows the amount of memory being used by the kernel buffer cache. The buffer cache is used to speed up disk operations, by allowing disk reads and writes to be serviced directly from memory. The buffer cache size will increase or decrease as memory usage on the system changes; this memory is reclaimed if it is needed by applications. Therefore, although we see that ~1.86 GB of system memory is in use, not all (but most) of it is being used by application programs.
5. The “cache” column indicates how many memory pages the kernel has cached for faster access later. Since the memory used for buffers and cache can easily be reclaimed for use by applications, the second line (-/+ buffers/cache) provides an indication of the memory actually used by applications (the “used” column) or available to applications (the “free” column). The sum of the memory used by buffers and cache reported in the first line is subtracted from the total used memory and added to the total free memory to give the two figures on the second line.
6. In the third line, we see the total amount of swap, 4192956 blocks (about 4 GB). In this case, only very little of the swap is being used; there is plenty of physical RAM available. If additional applications were started, larger parts of the buffer cache memory would be used to host them. Swap space is generally used as a last resort when the system can’t reclaim physical memory in other ways. Note that the amount of swap reported by free is somewhat less than the total size of your swap partitions and files. This is because several blocks of each swap area must be used to store a map of how each page in the swap area is being utilized. This overhead should be rather small; only a few kilobytes per swap area.

Leave a Reply