Ubuntu – The difference between free and vmstat commands

command linememory usage

vmstat output:

procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 1  1      0 1001568  84736 500928    0    0    47    30   36   63  1  0 99  1

free output :

             total       used       free     shared    buffers     cached
Mem:       1918500     916592    1001908          0      84732     500576
-/+ buffers/cache:     331284    1587216
Swap:      1948668          0    1948668

How total memory in vmstat is calculated ?

Best Answer

  • From the manpages: free, vmstat

    free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The shared memory column should be ignored; it is obsolete.

    vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

    The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case.