Top command to display% cpu in descending order

I would like to have a percentage of the processor in descending order. When I give the command:

top -bn 1 | grep "^ " | awk '{ printf("%-8s  %-8s \n", $2, $9); }' | head -8

It shows processes that are not the most popular with the CPU.

+6
source share
3 answers

Running from above as a process (I am using Ubuntu 14.04)

top

Once on top ...

P <- Sort by CPU usage

M <- Sort by using MEM

z <- add cool visual colors

x <- Select the column you are currently sorting,

+21
source

In your team you have

grep "^ "

which filters out lines that do not start with a space.

PID 4 , top PID 5 .

grep "^[0-9 ]" .

+1

Try on top with the -u flag: top -u

0
source

Source: https://habr.com/ru/post/1542661/


All Articles