Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2014 02:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/470bb40b05173fdb6348 to your computer and use it in GitHub Desktop.
Save anonymous/470bb40b05173fdb6348 to your computer and use it in GitHub Desktop.
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