Created
October 30, 2014 20:38
-
-
Save SamRothCA/b04f81897f48d0b1e36f to your computer and use it in GitHub Desktop.
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
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
Hi,
It should be
Thanks for the script.