How to kill multiple processes
You can use pkill:
pkill httpd
You may also want to use process substitution(although this isn't as clear):
kill $(pgrep command)
And you may want to use xargs
:
pgrep command | xargs kill
You can use killall
as well, e.g.
killall firefox
to send SIGTERM
to all firefox
processes.
Yes, you can use a bash feature and looping over the output.
$ for proc in $(pgrep <process command>); do kill $proc; done