Created
December 3, 2012 07:12
-
-
Save mikecao/4193296 to your computer and use it in GitHub Desktop.
Linux memory usage in human readable format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps -eo size,pmem,pid,user,comm | sort -rn | head -10 | awk '{ hr[1024**2]="GB"; hr[1024]="MB"; for (x=1024**3; x>=1024; x/=1024) { if ($1>=x) { printf ("%6.2f %s ", $1/x, hr[x]); break } } } { printf ("%5s%% %-8s %-10s ", $2, $3, $4) } { for ( x=5 ; x<=NF ; x++ ) { printf ("%s ",$x) } print (" ") }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment