Command for finding process using too much CPU
39,718
Solution 1
Or using a few other utils you could do:
ps aux | sort -rk 3,3 | head -n 5
Change the value of head to get the number of processes you want to see.
Solution 2
Try doing this :
top -b -n1 -c
And if you want the process that takes the most %CPU times :
top -b -n1 -c | awk '/PID *USER/{print;getline;print}'
or
top -b -n1 -c | grep -A 2 '^$'
Author by
user1136342
Updated on July 22, 2022Comments
-
user1136342 almost 2 years
What command can I use to find a process that's using a lot of CPU? Can I do this without installing something new?
-
Thomas almost 8 yearsOn my system, the last two commands consistently give me
top
as the command using the most CPU :) -
mVChr about 7 yearsThis can just be
ps aux --sort=-pcpu | head -n5
but if you want to use sort you should include the-n
(numeric) option otherwise6.5
will be higher than32.5
. Otherwise, thanks!