How can I look at several processes at once, instead of just one?

For example… typing in bash, shows bash processes.. how to I show both bash and say httpd?

First thoughts.. bash|httpd, no. Or bash httpd, no. Long story short, nothing i tried worked. Is it possible?

enter image description here

  • 2
    What are you ultimately trying to achieve? Command-line tools top and ps list running processes. Depending on what you're trying to do, perhaps running one of those commands and filtering the output with grep would be a better solution. – bneely Feb 4 '12 at 14:57
  • its just nice to keep an eye on "some processes" rather than "just one" or "all of them".... but as is often the case, apple almost deliberately seems to disable access to any sort of usable sorting or filtering syntax - although it's all there, underneath the skin.. instead strong-arming "simplicity" - over clever, and unobtrusive implementations that would let people who need "more meta" - have it. – alex gray Feb 4 '12 at 17:01

This doesn't seem to be possible with Activity Monitor. Unfortunately top doesn't accept several pids to monitor either, so you have to revert to a half-manual (and rather unelegant) solution using Terminal:

while :; do
    top -l 1 -pid PID-TO-MONITOR | tail -1
    top -l 1 -pid ANOTHER-PID-TO-MONITOR | tail -1
    sleep 5

Given some basic bash skills you can wrap this into a shell script if needed often.

Or open several terminal windows and run top on specific processes in each of them. Might be kind of heavy on your CPU though...

| improve this answer | |
  • thanks for the answer, although the result is pretty icky... 22057 mdworker 0.0 08:01.26 6 3 67+ 267+ 24M+ 46M+ 37M+ 100M+ 2512M+ 22057 477 stuck 501 4711582+ 563+ 2541479+ 698439+ 9115613+ 4938769+ 1364892+ 35330+ 18K+ 95M+ localadmin etc.. but it refreshes like a madman.. limiting the usefullness. oh well, accepted until something dreamier comes along :-). – alex gray Sep 18 '12 at 9:21

To supplement @Patrix command line suggestion: use grep to match multiple PIDs by name. For example:

top -s 2 -l 5 | grep -w 'bash\|httpd'

Samples processes matching either bash or httpd every 2 seconds over 5 queries (10 seconds total to run).

More generally:

top -s [interval time in seconds] -l [# of intervals] | grep -w 'process1\|process2\|process3'

| improve this answer | |

You must log in to answer this question.

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