Jran_Haugli
October 5th, 2015, 09:11 AM
Hi!
I have been running around on the internet trying to find the ultimate command to get CPU Usage in percent. I found alot of results that works in some how, but how accurate are they?
Im looking for a command which shows active CPU usage, not a average result.
Have anyone found the ultimate command?
This is my current commands:
UPTIME:
cat /proc/stat | grep btime | awk '{ print $2 }'
CPU
grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'
RAM:
free | awk 'FNR == 3 {print $3/($3+$4)*100}'
HDD:
df /home | awk '{ print $5 }' | tail -n 1
(Im also looking for RAM and HDD)
Regards,
Haugli92
I have been running around on the internet trying to find the ultimate command to get CPU Usage in percent. I found alot of results that works in some how, but how accurate are they?
Im looking for a command which shows active CPU usage, not a average result.
Have anyone found the ultimate command?
This is my current commands:
UPTIME:
cat /proc/stat | grep btime | awk '{ print $2 }'
CPU
grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'
RAM:
free | awk 'FNR == 3 {print $3/($3+$4)*100}'
HDD:
df /home | awk '{ print $5 }' | tail -n 1
(Im also looking for RAM and HDD)
Regards,
Haugli92