Thursday, July 21, 2011

Linux – Kill a Process by Name

If you know the command

ps -A

then tou will probable also know

ps -A | grep firefox

now you can manually kill this via

kill -9

Where is from the last output. But how to do this in one line? If your ps command knows:

ps opid= -C firefox
(should print the )

Then you can simply do

kill -9 $(ps opid= -C firefox)

No comments: