Just looking for some quick help regarding free -m
output on Linux. Here's an example on one of my servers:
$free -m
total used free shared buffers cached
Mem: 14881 14813 68 0 262 883
-/+ buffers/cache: 13667 1213
Swap: 4095 240 3855
I understand the kernel can and will use available memory for disk caching to speed up the system.
Normally, I look at the second value in the "free" column, in the above case it's 1213. It's normally a lot higher than this.
I guess I am looking to understand what the two outputs next to '-/+ buffers/cache' mean. From what I can see, the system truly is low on memory (only 1213MB available for applications to use) and the OS actually needs 13GB for caching?
This has been answered in serverfault. Here is the relevant excerpt:
total
=used
+free
shared
/buffers
/cached
: This shows memory usage for specific purposes, these values are included in the value forused
.The second line gives first line values adjusted. It gives the original value for
used
minus the sumbuffers+cached
and the original value forfree
plus the sumbuffers+cached
, hence its title. These new values are often more meaningful than those of first line.[End of excerpt]
Focusing on your situation,
In the event an application needs more memory, it can be taken either from free memory or from cached/buffered, so:
The system does not really need 262+883=1145 (not 13GB) for cache and buffers, but since it's there, it takes it (but gives it back if applications need more). Take a look at the Linux ate my RAM! page.
You can also use
top
(I personally preferhtop
) to see the memory status and which applications are taking most RAM.As an example, here is a screenshot of htop running in my RaspberryPi and the
free -h
execution: