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?
Asked by yael
(13936 rep)
Feb 1, 2018, 12:33 PM
Last activity: Aug 31, 2021, 11:51 AM
Last activity: Aug 31, 2021, 11:51 AM