Skip to main content

how How to find the right memory size?

weWe have linuxa Linux machine with 32G

we. We capture the mem as the follwingas follows:

mem=` cat /proc/meminfo | grep MemTotal | awk '{print $2}' ` echo $mem 32767184 

and now we convert it to GIGA:

mem_in_giga=` echo $(( $mem / 1024 / 1024)) ` echo $mem_in_giga 31 

but from the results we get 31 and not 32G.

theThe same story with freethe free command:

free -g total used free shared buff/cache available Mem: 31 9 17 0 4 20 Swap: 7 0 7 

soSo how todo we get the 32G by"32G" from any command solution?

how to find the right memory size

we have linux machine with 32G

we capture the mem as the follwing

mem=` cat /proc/meminfo | grep MemTotal | awk '{print $2}' ` echo $mem 32767184 

and now we convert it to GIGA

mem_in_giga=` echo $(( $mem / 1024 / 1024)) ` echo $mem_in_giga 31 

but from results we get 31 and not 32G

the same story with free command

free -g total used free shared buff/cache available Mem: 31 9 17 0 4 20 Swap: 7 0 7 

so how to get the 32G by any command solution?

How to find the right memory size?

We have a Linux machine with 32G. We capture the mem as follows:

mem=` cat /proc/meminfo | grep MemTotal | awk '{print $2}' ` echo $mem 32767184 

and now we convert it to GIGA:

mem_in_giga=` echo $(( $mem / 1024 / 1024)) ` echo $mem_in_giga 31 

but from the results we get 31 and not 32G.

The same story with the free command:

free -g total used free shared buff/cache available Mem: 31 9 17 0 4 20 Swap: 7 0 7 

So how do we get "32G" from any command?

Post Reopened by Stephen Kitt linux
Post Closed as "Duplicate" by Rui F Ribeiro linux
edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266
Source Link
yael
  • 14k
  • 72
  • 221
  • 377

how to find the right memory size

we have linux machine with 32G

we capture the mem as the follwing

mem=` cat /proc/meminfo | grep MemTotal | awk '{print $2}' ` echo $mem 32767184 

and now we convert it to GIGA

mem_in_giga=` echo $(( $mem / 1024 / 1024)) ` echo $mem_in_giga 31 

but from results we get 31 and not 32G

the same story with free command

free -g total used free shared buff/cache available Mem: 31 9 17 0 4 20 Swap: 7 0 7 

so how to get the 32G by any command solution?