Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.