Check Your Free Memory with "free"
Finding out how much free memory a Linux system has available can be tricky. Linux uses all of the RAM it can because unused RAM is wasted RAM. RAM that is not needed for applications is used for buffers and cache. The command in Linux for getting memory information is called free, which is always installed by default. To view the results in megabytes, use the -m switch.
free -m
The result will look like this:
total used free shared buffers cached
Mem: 1010 857 152 0 205 367
-/+ buffers/cache: 284 726
Swap: 1027 149 877
tom@tomstation:~$
Looking at the “Mem” line it would look like there is only 152 MB of free RAM available for applications. The “-/+ buffers/cache” line subtracts the buffers and cache from the used memory. This line shows that there is plenty of RAM available.
You can just view the line with the buffers and cache subtracted with grep.
free -m | grep cache
That will give you the best idea of your system’s RAM usage.
Archived Comments
Daniel
Exactly what I was looking for, thank you both.
Beeker
It’s important to know what ‘buffer’ and ‘cache’ are used for; the cache is data that’s been read from the disk and may be used again (think of how quickly ‘find’ runs when you run it the second time) and the ‘buffer’ is data that needs to be written to disk but is also being kept in memory for quick access. Think of edits made to a graphics file, for example.