Last active
July 11, 2017 15:14
-
-
Save JesseFinch/363ebf3331969440266bbe59438f2718 to your computer and use it in GitHub Desktop.
top 20 process by memory usage
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/bash | |
watch -n 1 'bash memory_usage.sh' |
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
# show top 20 process ordered by memory usage | |
#!/bin/bash | |
ps axo rss,comm,pid \ | |
| awk '{ proc_list[$2]++; proc_list[$2 "," 1] += $1; } \ | |
END { for (proc in proc_list) { printf("%d\t%s\n", \ | |
proc_list[proc "," 1],proc); }}' | sort -n | tail -n 20 | 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