-
-
Save EvanLovely/7edc4815efc4536e087c to your computer and use it in GitHub Desktop.
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 xro %cpu=,comm= | while read cpu comm; ((i++<5)); do | |
int=$cpu | |
int="${int%%.*}" | |
if (($int >= 50)); then color=$'\e[31m'; | |
elif (($int >= 25)); then color=$'\e[33m'; | |
else color=$'\e[32m'; | |
fi; | |
echo "$color$cpu% $(basename "$comm")"$'\e[0m'""; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment