How to find actual free RAM available in your Linux system

Category : Linux/ Unix

1. The following command will help you get the details of total ram, ram usage, free available ram.

free -m

Output:


% free
             total       used       free     shared    buffers     cached
Mem:       2061712     490924    1570788          0      60984     220236
-/+ buffers/cache:     209704    1852008
Swap:       587768          0     587768

The main point to note here is that the “used” memory in the first line doesn’t denote the “actual used memory” because the system would dump cache if needed more memory for a process.

Then what is exactly the actual used and free memory usage?

The answer lies in the next line ” (-/+ buffers/cache:)”: It gives us the actual used and free memory considering there are no buffers and cache.

2.The following command will report the percentage of memory in use

free | grep Mem | awk ‘{print $3/$2 * 100.0}’

23.7171

 

3.This will report the percentage of memory that’s free

free | grep Mem | awk ‘{print $4/$2 * 100.0}’

76.6013