Skip to content

Instantly share code, notes, and snippets.

@FlowerWrong
Created September 24, 2020 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlowerWrong/b1671bbcb372cb22cb58a0250b27e640 to your computer and use it in GitHub Desktop.
Save FlowerWrong/b1671bbcb372cb22cb58a0250b27e640 to your computer and use it in GitHub Desktop.
Display Processes Sorted By Memory Usage in Linux
ps axo rss,comm,pid \
| awk '{ proc_list[$2] += $1; } END \
{ for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc],proc); }}' \
| sort -n | tail -n 10 | sort -rn \
| awk '{$1/=1024;printf "%.0fMB\t",$1}{print $2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment