Penguin Crumbs

Notes and tips from a Linux user

home about this blog
search:  

How to understand the amount of free memory

On our Linux desktops there are widgets and plugins that show the state of the system at a glance. However I found that only few people can understand the usage of RAM from the command line. So, let’s see how to read the output of the free command: you just have to know wich values ​​to pick 🙂

There are two versions of free and the old one has a different output than the new one. In the following two examples I colored the numbers that you can use to compute the free memory percentage.

The old version of free:
the output of the old version of free
It means that in this case, to get the right value of free memory you must read the second number in the line “-/+ buffers/cache”.

The new version of free:
the output of the new version of free
This output is simpler: the free memory corresponds to the last value in the first line, labeled as “available”.

Then, why are there all those other numbers? The reason is that the free command explains in more detail how much the operating system is using buffers and cache, which are mechanisms to speed up writing and reading data on the hard disk. Since Linux is very efficient in allocating and de-allocating these portions of memory, normally you don’t have to worry about it, even if you see high values.

 
 
Posted on 2019-05-17  
 
⇦  back
 
__________________
 
Copyright © 2019-2024 Marcello Zaniboni