I\'m typing a shell script to find out the total physical memory in some RHEL linux boxes.
First of all I want to stress that I\'m interested in the total ph
cat /proc/meminfo | grep MemTotal
or free gives you the exact amount of RAM your server has. This is not "available memory".
I guess your issue comes up when you have a VM and you would like to calculate the full amount of memory hosted by the hypervisor but you will have to log into the hypervisor in that case.
cat /proc/meminfo | grep MemTotal
is equivalent to
getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) total *=$NF} END {print total / 1024" kB"}'