Created
April 15, 2023 12:58
-
-
Save edr3x/5476bed36159a0e37cfba83c69ebefb5 to your computer and use it in GitHub Desktop.
print current cpu usae of a system
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
#!/usr/bin/env bash | |
cat /proc/stat | grep cpu | tail -1 | awk '{print ($5*100)/($2+$3+$4+$5+$6+$7+$8+$9+$10)}' | awk '{print 100-$1}' | xargs printf "%.1f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment