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 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -