How to interpret output of "free -m" command?

You have 112 MB of completely free memory, BUT the 501 mb you see is without 'cached' memory. This means that the OS has put some stuff in your memory to be quicker. It calls this "used" (therefore your 'free' number is only 112), but it is actually available for you if you need it.

This is a good thing, because unused memory is useless memory. The cached memory can be cleared if needed. The old "I need to clean up memory" stuff people used to do for windows 95 isn't needed here: it's all fine and happy :)

The number you are looking for is 501 free (in megabytes because of -m).

see for reference these pages:

http://www.linuxatemyram.com/
http://www.itworld.com/it-managementstrategy/280695/making-sense-memory-usage-linux


Interpretting output of free:
The first line of the free output lists:

  • total Your total, physical (assuming no virtualization) memory
  • used How much of that is currently used (by anything)
  • free How much of that is completely free (not used at all)
  • shared (never anything there, ignore that column)
  • buffers Memory used by kernel buffers
  • cached Memory used for cache

The last two items, cache and buffers, is memory that is not allocated to specific user processes. It is memory reserved by the kernel to improve performance overall, but is not "application" memory. These areas will grow or shrink depending on kernel policies with respect to caching, memory pressure, application I/O patterns, etc.

Since these two columns are not user-allocated memory, and the zones can shrink (practically to zero) if user allocations require it, they are in a sense "free" - there's RAM there that can be freed up by the kernel if your apps actively need it.

That's what the second line tells you. It removes the buffer and cache memory from the used column (that's what the - means), and adds (+) them to the free column. (Rounding issue will happen.)

(The last line shows the state of your swap space.)

Courtesy: https://unix.stackexchange.com/a/33549/14497

So, in your case 112MB is the completely free memory, and if you take into consideration the memory used for caching, which can be allocated to the user applications, if needed; then 501 MB is the actual maximum memory available for use.


The answer by @saji89 is excellent, but these days free -m no longer prints the -/+ buffers/cache line, but instead puts the amount of available RAM in a new available column on the first line, for example:

ubuntu@pg_master:~$ free -m
              total        used        free      shared  buff/cache   available
Mem:          61406        1571         506       17131       59328       42150
Swap:             0           0           0
ubuntu@pg_master:~$ free -V
free from procps-ng 3.3.10

You can read the commit to free(1) that removed the line in their repo. Also the commit to add the new available column.