Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In some cases killing a single tab/process doesn't do it and I need to close Chrome entirely. Since Chrome has multiple processes, how can I close all of them at once?

I know that...

pgrep chrome returns all the pids. What is a trick that would allow me to close all of them by feeding them to another command or merging them to a CSV file or something?

share|improve this question

migrated from Apr 14 '10 at 20:02

This question came from our site for professional and enthusiast programmers.

Since there are at least three answers here that needlessly do kill -9, here are three reference discussing the reasons that should be your last choice: When should I use kill -9, kill -9 and Useless use of kill -9. – Dennis Williamson Apr 14 '10 at 20:57
up vote 34 down vote accepted

Try using pkill(1).

pkill chrome

share|improve this answer
just be aware that pkill might not be on all systems, but if you have pgrep, more than likely pkill exists as well. – kSiR Apr 14 '10 at 19:36
for me this was case sensitive, I needed to write pkill Chrome – Liron Yahdav Sep 30 '14 at 18:04

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.

share|improve this answer
You shouldn't use -9 except as a last resort. Do kill PID first. – Dennis Williamson Apr 14 '10 at 20:52
ps aux | grep chrome | awk ' { print $2 } ' | xargs kill -9


pgrep chrome | xargs kill -9


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


share|improve this answer
Is there any reason to use ps ... | instead of pgrep, even supposing you don't want to use pkill? – Jefromi Apr 14 '10 at 19:36
It's also always polite to start with SIGTERM before escalating to SIGKILL. – Jefromi Apr 14 '10 at 19:39
not really, only reason i threw the ps option out there is due to alot of my systems are bare bones meaning we dont have things like pkill pgrep – kSiR Apr 14 '10 at 19:39
I agree, but one just asked to kill :-O s/-9/-1/g – kSiR Apr 14 '10 at 19:39

You should really just use pkill as jschmier suggests, but if you insist on pgrep, just use command substitution:

kill $(pgrep chrome)
share|improve this answer
would'nt kill pgrep chrome`` also work ;) – kSiR Apr 14 '10 at 19:53
@kSiR: [a month late] yes, but $(...) is a great habit to get into so you can nest when you need to, and flip between matching delimiters in your editor. – Jefromi May 12 '10 at 18:27

You can also try something like this:

ps -C chrome |cut -f 1 -d' ' | xargs kill
share|improve this answer
You shouldn't use -9 except as a last resort. Do kill PID first. – Dennis Williamson Apr 14 '10 at 20:53
good point. I updated my answer. – Nathan Fellman Apr 15 '10 at 7:08
No need for another pipe through cut; ps can do it itself: ps -o pid= -C chrome | xargs kill. – musiphil Sep 4 '14 at 19:09
And it's a good habit to put -r in xargs: ps -o pid= -C chrome | xargs -r kill. – musiphil Sep 4 '14 at 19:10
@musiphil: what is -r? – Nathan Fellman Sep 4 '14 at 19:11

The easiest command is this one:

sudo killall chrome

This will, with administrative permissions, kill all processes that contain chrome in their name.

See man killall for more information...

share|improve this answer
Could you add a bit of explanation about how your answer works? – nhinkle Nov 1 '11 at 4:43

Under Ubuntu, this is what worked for me:

pkill chromium

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .