Created
December 17, 2018 17:15
-
-
Save mgbckr/0479dc667c60edc1851775bf8899127f to your computer and use it in GitHub Desktop.
Script to show CPU usage (percent) by user
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
#!/bin/bash | |
# start with `watch -n 1 bash utop.sh` for continuous monitoring | |
top -b -n 1 | awk ' | |
NR <= 7 { print; next } | |
{ a[$2] += $9 } | |
END { | |
for (i in a) { | |
printf "%-15s\t%s\n", i, a[i]; | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment