I have a process called "P1", right now the way I kill the process is:
$ ps aux | grep "P1"
" Now it returns two processes related to "P1": one is the actual P1 process I want to kill, the other one is the "grep P1" which I don't care.
$ kill -9 <P1 pid>
However, I wish to combine the two processes into one. Currently I couldn't find an efficient way to do that mainly because I have to look for the from the output of the first command. Any good method?
pkill -x P1
is the right way.