How to find top CPU utilization processes

At frequent intervals, cpu will be utilized high however sometimes you can’t find which process is consuming. Below commands will help you to find top consuming cpu processes.

[root@rhel6-1 ~]# ps -eo pcpu,args --sort=-%cpu | head -n 10
%CPU COMMAND
 0.8 /sbin/init
 0.8 /sbin/udevd -d
 0.1 hald
 0.0 [kthreadd]
 0.0 [migration/0]CPU 
 0.0 [ksoftirqd/0]
 0.0 [migration/0]
 0.0 [watchdog/0]
 0.0 [events/0]
[root@rhel6-1 ~]# 
[root@rhel6-1 ~]# top -b -n 1 | head -n 12  | tail -n 5
    1 root      20   0 19356 1500 1188 S  0.0  0.1   0:00.84 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0
[root@rhel6-1 ~]# ps -eo pcpu,pid,user,args --no-headers| sort -t. -nk1,2 -k4,4 -r |head -n 10
 0.0     9 root     [khelper]
 0.0     8 root     [cgroup]
 0.0   807 root     [flush-253:0]
 0.0     7 root     [events/0]
 0.0   799 root     [kauditd]
 0.0   755 root     [ext4-dio-unwrit]
 0.0   754 root     [jbd2/vda1-8]
 0.0    72 root     [kstriped]
 0.0     6 root     [watchdog/0]
 0.0     5 root     [migration/0]
Posted in: Linux

Leave a Comment