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

前端 未结 13 1835
梦如初夏
梦如初夏 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

    One more useful command:
    vmstat -s | grep memory
    sample output on my machine is:

      2050060 K total memory
      1092992 K used memory
       743072 K active memory
       177084 K inactive memory
       957068 K free memory
       385388 K buffer memory
    

    another useful command to get memory information is:
    free
    sample output is:

                 total       used       free     shared    buffers     cached
    Mem:       2050060    1093324     956736        108     385392     386812
    -/+ buffers/cache:     321120    1728940
    Swap:      2095100       2732    2092368
    

    One observation here is that, the command free gives information about swap space also.
    The following link may be useful for you:
    http://www.linuxnix.com/find-ram-details-in-linuxunix/

提交回复
热议问题