How can I find out the total physical memory (RAM) of my linux box suitable to be parsed by a shell script?

前端 未结 13 1846
梦如初夏
梦如初夏 2020-12-07 09:52

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

13条回答
  •  渐次进展
    2020-12-07 10:07

    Add the last 2 entries of /proc/meminfo, they give you the exact memory present on the host.

    Example:

    DirectMap4k:       10240 kB
    DirectMap2M:     4184064 kB
    

    10240 + 4184064 = 4194304 kB = 4096 MB.

提交回复
热议问题