free - Linux tools 2 of n

"free" is used to check the system's memory information.

Let's understand its output.

sysadmin@ubuntu:~$ free
                 total             used            free           shared    buffers     cached
Mem:       2047900    1169720     878180          0          87280     951716
-/+ buffers/cache:      130724       1917176
Swap:      2094076          0            2094076

The second line (Mem:)
total 2047900:  is the total physical memory in the system (subtracts some overhead)
used 1169720: is the used physical memory in the system 
free 878180: is the free physical memory in the system

total = used + free

buffers 87280: buffer memory (usually used by kernel for block io etc and usually is relative small). Can be freed by kernel if usable physical memory is really low.
cached 951716: disk data page cached in memory. Can be freed by kernel if usable physical memory is really low.

The third line (-/+ buffers/cache:)
used 130724 = (used 1169720  - buffers 87280 - cached  951716) in the second (Mem:) line (this is why it is using "-"  in "-/+ buffers/cache")
free 1917176 = (free 878180 + buffers 87280 + cached  951716)  in the second (Mem:) line (this is why it is using "+"  in "-/+ buffers/cache")
"buffers and cached" is potentially able to be recycled, this is why free count them as free.

你可能感兴趣的:(free - Linux tools 2 of n)