1 Answer
The pgrep command, and pkill, exists precisely for this purpose:
pgrep firefox will list all processes whose commands match firefox
pgrep -f firefox will list all processes whose entire command lines match firefox
pgrep -x firefox will list all processes whose commands exactly match firefox
... and so on.
And naturally, pgrep will exclude itself from the match, so none of the grep rituals associated with ps | grep are needed
Your Answer
x