Created
August 2, 2012 23:39
-
-
Save Gen2ly/3242078 to your computer and use it in GitHub Desktop.
Display the top application memory users
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 | |
# Display the top applications of memory usage | |
# http://www.cyberciti.biz/faq/linux-check-memory-usage/#comment-51021 | |
while read command percent rss; do | |
if [[ "${command}" != "COMMAND" ]]; then | |
rss="$(bc <<< "scale=2;${rss}/1024")" | |
fi | |
printf " %-26s%-8s%s\n" "${command}" "${percent}" "${rss} MB" \ | |
| sed 's/COMMAND/PROGRAM/' | sed 's/RSS MB/#MEM/' | |
done < <(ps -A --sort -rss -o comm,pmem,rss | head -n 10) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment