top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to get CPU Utilizationand CPU Load in Linux?

+3 votes
813 views

Result should be in xx.xx format (like 01.65).

posted Dec 18, 2013 by Satyabrata Mahapatra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Try the following two command

top -b -n 1|grep Cpu|cut -d " " -f 3
top -b -n 1|grep Cpu|cut -d " " -f 3|cut -d"%" -f 1
answer Dec 18, 2013 by Salil Agrawal
+1 vote

top -p pgrep process_name -b -n 1 -d 1.0 |grep -e "^Cpu" |awk {'print $2'} | tr "%us," " " > cpu_file.log

answer Dec 19, 2013 by Nithin Kp
I need overall load for all processes.
For overall load - Need to remove the process name.. Thats all
top -b -n 1 -d 1.0 |grep -e "^Cpu" |awk {'print $2'} | tr "%us," " " > cpu_file.log
I am using this one check:

    top -b -n 10 -d 0.0 | grep -e "^Cpu" | tr "," " " | grep -e "%id" | awk {'print 100-$5'} | sort -rn | head -1
Similar Questions
+2 votes

I want to run a command in every 10 minute which should return the maximum CPU utilization of a linux machine in last 10 min irrespective of no. of core present.
Thanks in advance.

...