Skip to end of metadata
Go to start of metadata


In some cases, you may want to know the number of processes working in the system. You can know it by grep -ef | grep <process name> | wc -l

Following is the example to check the total number of process for "postgres":

ps -ef | grep postgres | wc -l


Following is the example to check the total number of process for "ffmpeg":

ps -ef | grep ffmpeg | wc -l

If you want to check the processes with full path,

ps -aux | grep bot 

Then, you will see:

root     17364  0.0  0.0 436760 19536 ?        S    09:00   0:00 php /pub/production/_bot/bot_main.php
root     17402  0.0  0.0 113284  1596 ?        Ss   09:00   0:00 bash -c cd "/lib/production/_bot" && php import_db.php
root     17933  0.0  0.0 436760 19532 ?        S    09:05   0:00 php /pub/production/_bot/bot_main.php
root     18038  0.0  0.0 113284  1596 ?        Ss   09:05   0:00 bash -c cd "/lib/production/_bot" && php channels.php
kurapa   21211  0.0  0.0 112816   972 pts/2    S+   09:28   0:00 grep --color=auto bot

To count its list,

ps -aux | grep bot | wc -l