Overview
This article provides information on how to calculate total free memory.
Information
- As per Understanding the output of command free -m, Free memory is actually read directly from the
/proc/meminfo
- More on this can be checked by running the command man free
- However, if buffers and Cache (reclaimable memory) is also taken into account, then Available Memory might be more suitable.
- Formula for calculating % available memory is:
free -m | awk '/^Mem/ {print "Total Mem:", $2, "Total Mem (Free):", ($7)/$2*100, "%"}' OFMT="%.2f"
- Sample snapshot of the output is:
Note: The understanding of Used and Free memory is subjective. The above formula is provided as per our best understanding based on RHEL forums and manuals, which you may consult for more information.