I use ps command to find out all running process. You may also pipe out ps command output through grep command to pick up desired output.
Let us run a combination of ps command and grep command to find out all Perl processes:
$ ps aux | grep perl
vivek 4611 0.0 0.7 10044 6068 ? Ss 02:40 0:00 /usr/bin/perl apps/monitor/gwl.pl root 4853 0.0 0.7 10044 6068 ? Ss 02:40 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf vivek 5166 0.0 0.0 2884 748 pts/0 R+ 03:06 0:00 grep perl
In above example, I am getting the grep process itself. To ignore grep process from the output, type any one of the following:
$ ps aux | grep '[p]erl'
$ ps aux | grep perl | grep -v grep
You don’t want display grep command as the process in ps output, i.e., you want to prevent ‘grep’ from showing up in ps results. In first command I used regex. It says find the character ‘p’ followed by ‘erl’ i.e. the expression ‘[p]erl’ matches only ‘perl’ not ‘[p]erl’, which is how the grep command itself is now shown in the process list. The second command uses the -v option to invert the sense of matching, to select non-matching lines.