View Single Post
Old 08-21-2004, 06:51 PM   #13 (permalink)
GoogleMeister
Upright
 
Quote:
Originally Posted by Latch
Unless it catches it's own grep.... I've run into that often enough.

Code:
latch@afx:~$ ps -ef | grep tomato
latch    24337 24325  0 18:12 pts/457  00:00:00 grep tomato
latch@afx:~$
gotta grep out the grep.. i.e.:

ps -ef | grep proccessIDorprocessName | grep -v grep

Then you can pipe to wc -l or whatever you'd like hehe.

Code:
latch@afx:~$ ps -ef | grep bash
latch     8370     1  0 Aug12 ?        00:00:00 /bin/bash /usr/bin/thunderbird
latch    25518     1  0 Aug14 ?        00:00:00 /bin/bash ./restartScript
latch    24020     1  0 17:59 ?        00:00:00 /bin/bash /usr/bin/firefox
latch    24325 24323  0 18:12 pts/457  00:00:00 -bash
latch    24434 24325  0 18:15 pts/457  00:00:00 grep bash
latch@afx:~$ ps -ef | grep bash | grep -v grep
latch     8370     1  0 Aug12 ?        00:00:00 /bin/bash /usr/bin/thunderbird
latch    25518     1  0 Aug14 ?        00:00:00 /bin/bash ./restartScript
latch    24020     1  0 17:59 ?        00:00:00 /bin/bash /usr/bin/firefox
latch    24325 24323  0 18:12 pts/457  00:00:00 -bash
latch@afx:~$ ps -ef | grep bash | grep -v grep | wc -l
4
latch@afx:~$
Ahhhhh... The vageuries of different shells, systems and utilities. How many things in hte Windows world spawn such great conversation?
GoogleMeister is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43