1

I want to use top, but not see all of the processes that are using minute chunks of computing power. Can someone tell me how to use top to see things above a certain cpu % cutoff? I tried just using vanilla top that ranks processes by CPU usage and pass it through head, but it doesn't refresh: top | head -n 15

Thanks!

0

2 Answers 2

1

On OS X top (which should be similar to BSD top), you can run top -o cpu -n 10 to display the top 10 processes by CPU usage.

1
  • 2
    On CentOS and Ubuntu, -n means something different (maximum number of iterations before exiting) and -o cpu should be -o %CPU.
    – IpsRich
    Sep 28, 2017 at 14:39
0

I don't see the point of what you're trying to do since top sorts by CPU% by default so all you need is to resize your terminal window to only have the top processes showing.

The GNU top I have on my Debian has no option for this in man top, but you could always run something convoluted like:

watch  "top -bn1 | awk '{if(/^[^0-9 ]/){print}else if(\$9 >= 10){print}}' "

This uses watch which will run the specified command every two seconds (by default, change the interval with -n) and gawk to parse the output of top in batch mode and only print the processes using at least 10% CPU.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .