0

Using Geektool I want to output some of the stats that top spits out on my desktop, but not all of them. Rather than calling top | grep "Line_I_want_to_spit_out" for each different line I want it to show(resulting in 5-6 separate calls to top), is it possible to just call top once and select the lines I want it to show? (ex. show Processes, CPU usage, PhysMem, and the top 10 processes ordered by cpu)

flapjacks
  • 117
  • 5

2 Answers2

1

If you're not averse to using grep, you can do something like top | grep -E "Line1|Line2|etc"

BowlesCR
  • 2,697
  • 12
  • 19
  • That definitely works for the information on top. Do you know if it's possible to also have it show the top 10 processes ordered by cpu usage (top -n10 -o-CPU -stats cpu,command)? Or would that have to be a second call to top? – flapjacks Feb 13 '13 at 21:18
-1

Use:

ps -arcwwwxo "command %cpu %mem" | grep -v grep | head -9
Gaff
  • 18,569
  • 15
  • 57
  • 68
rob
  • 1
  • 1
    While this might answer the question it might be good to break out and explain the separate parts to educate as well as answer the question. – Mokubai Dec 13 '16 at 07:22