Hi,
I've been searching for a neat way of finding the total instantaneous CPU usage as a %, and found all sorts of tedious solutions.
I thought I'd share a simple one-liner that accomplishes the task really simply:
Basically, it grabs the CPU column from top and sums all the values together. Simple as that.Code:top -bn 1 | awk '{print $9}' | tail -n +8 | awk '{s+=$1} END {print s}'
Enjoy!




Adv Reply


Bookmarks