how to count the number of occurrences of a process
I WAS going to ask how to do this but since I figured it out I present it to fellow n00bs(and myself in case I forget).
I wanted to know how many occurrences of a process that I have running-- command: ps -aux|grep 'some_process'|wc -l explanation: 1)take the current listing of all processes in BSD format 2)search for all lines containing 'some_process' 3)then count how many lines 'some_process' occurs on. Is there a better way to do this? |
Code:
pidof <process name> | wc -w |
variations about this theme....
Code:
$ pgrep <process_name> | wc -l |
Quote:
I know I'm only running one copy of "init", but see below where my count would have been two by your method: Code:
$ ps aux | grep init |
All times are GMT -5. The time now is 03:10 AM. |