I know some of you might find my question stupid but i need to know how much ram is installed on a centos box Yes i know it can easily be done by using the command
awk '/MemTotal/{print $2}' /proc/meminfo
However the problem is that the memory shown is not really want i need.The value shown will always be less than expected as some ram is used to load the kernel.Thus a 512 MB ram server will always show a little less than 524288 kb.
The reason while i need the full physical ram is very simple.I need to modify settings automatically on a box via my bash script. Thus if server has total 512 MB ram , one set of setting is used , if 1gb then another.....
I cannot gamble with the value return by the command above as value varies from system to system.
Any good valid option guys.......
Kind Regards
Here you go... From my larger script at: Documenting server details
Output: Installed Ram: 28672MB (or divide by 1024)
Unfortunately, dmidecore requires root privileges.
Another way to retrieve values, more accurate than MemTotal in /proc/meminfo :