Created
March 3, 2020 23:54
-
-
Save LolWalid/740f1c74430af7e90eb5dea8f4617693 to your computer and use it in GitHub Desktop.
Get 25 process consuming the most RAM
This file contains hidden or 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
#!/bin/sh | |
ps -eo rss,pid,user,command | sort -rn | head -25 | 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 ("%-6s %-10s ", $2, $3) } | |
{ for ( x=4 ; x<=NF ; x++ ) { printf ("%s ",$x) } print ("\n") } | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment