Created
October 23, 2014 02:40
-
-
Save anonymous/470bb40b05173fdb6348 to your computer and use it in GitHub Desktop.
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 xmo rss=,pmem=,comm= | while read rss pmem comm; ((n++<5)); do | |
size="$[rss/1024]"; | |
short=$[4-${#size}]; | |
size="(${size}M)"; | |
i=0; | |
while ((i++ < short)); do size=" $size"; done; | |
pmem="${pmem%%.*}" | |
if (($pmem >= 20)); then color=$'\e[31m'; | |
elif (($pmem >= 10)); then color=$'\e[33m'; | |
else color=$'\e[32m '; | |
fi; | |
echo "$color$pmem% $size $(basename "$comm")"$'\e[0m'""; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment