Free Linux command (memory usage)
The “-b”, “-k” and “-m” options show the amount in bytes, kbytes, and megabytes respectively:
The -h option shows the quantities in an easier to read way:
Below is the meaning of each field:
- total: Total RAM installed in the system;
- used: Memory used (total - free - buffers - cache);
- free: Available memory;
- shared: Memory shared between processes using tmpfs. Processes can allocate memory that they share, for example, with their child processes;
- buffers: Memory used as a clipboard by the kernel;
- cache: Memory used by the cache of memory pages;
- available memory regardless of the memory used in buffers and caching
In old versions of the free command, buffer and cache information were separated into two columns, because Linux divided the buffer cache into two categories. The buffer was the memory used by the Kernel, and the Cache was the memory used by processes for caching. It was decided to combine this information in a single column.
The free command also shows the amount of memory available and used in swap.
Swap is a disk area that can be used as a space for exchanging memory pages between RAM and disk, making it possible to virtually increase system memory through pagination between memory and disk. It is a feature that can be used to avoid running out of RAM memory.
If the system makes extensive use of Swap, it is a strong indication that there is a need to increase the amount of RAM depending on the use of the system.