Killing all instances of Chrome on the command-line?
Try using pkill(1).
pkill chrome
ps aux | grep chrome | awk ' { print $2 } ' | xargs kill -9
or
pgrep chrome | xargs kill -9
or
ps aux | awk '/chrome/ { print $2 } ' | xargs kill -9
The latter is more "elegant" as it will not pick up the actual pid for "grep chrome" inside of its ps listing
:-)
Some systems may also have useful programs such as killall
and pidof
(which is actually provided by the System V killall5
):
killall chrome
kill -9 `pidof chrome`
Both of these should accomplish what you are asking.