shell - How to display /proc/meminfo into Megabytes -
i want thank helping me related issue. know if cat /proc/meminfo display in kb how can display in mb ? want use cat or awk please.
this convert kb
lines mb
:
awk '$3=="kb"{$2=$2/1024;$3="mb"} 1' /proc/meminfo | column -t
this version converts gigabytes:
awk '$3=="kb"{$2=$2/1024**2;$3="gb";} 1' /proc/meminfo | column -t
for completeness, convert mb or gb appropriate:
awk '$3=="kb"{if ($2>1024**2){$2=$2/1024**2;$3="gb";} else if ($2>1024){$2=$2/1024;$3="mb";}} 1' /proc/meminfo | column -t