Sometimes I need to kill Google Chrome (of which I have 2 windows/instances opened). Both instances are not in incognito mode.

What I do is: (on Debian 8)

killall chrome && killall chrome

to have 2 windows of chrome closed.

However I read that killall command should kill all instances of a program, not just one.

So I was wondering: why killall doesn't kill all instances as the name would suggest?

  • killall does not mean "kill all these processes" but "send the (implicitly) specified signal to all these processes". See this question: unix.stackexchange.com/questions/85364/… – Hauke Laging Jan 26 '16 at 2:56
  • If you want to kill all Chrome instances you only need to kill the first process which spawned all other Chrome threads. It will have a parent process id of 1. Try pkill -P1 chrome and see if that does what you wish. – bsd Jan 26 '16 at 12:39

It is possible that one of the chrome instances is ignoring the SIGTERM signal, waiting for a second to confirm? killall -9 chrome may do what you want.

| improve this answer | |
  • it worked. it was probably due to the 2nd instance ignoring kill signal – dragonmnl Jan 26 '16 at 15:35
  • 2
    kill -9 is considered bad form and rarely needed. Only poorly written programs don't handle SIGTERM. Chrome is not one of these. – bsd Jan 27 '16 at 10:55
  • @bdowning agreed, it should only be used as a last resort. – zje Jan 27 '16 at 15:07

I tried it with 2 processes and it seems to work --

jai@jai-VirtualBox:/tmp$ sleep 100 &
[1] 3996
jai@jai-VirtualBox:/tmp$ sleep 60 &
[2] 3997
jai@jai-VirtualBox:/tmp$ pgrep -l sleep
3996 sleep
3997 sleep
jai@jai-VirtualBox:/tmp$ killall -v sleep
Killed sleep(3996) with signal 15
Killed sleep(3997) with signal 15
[1]-  Terminated              sleep 100
[2]+  Terminated              sleep 60

jai@jai-VirtualBox:/tmp$ pgrep -l sleep

Could you try again with -v or -i (interactive) ?

| improve this answer | |
  • thanks for your answer. I didn't get the purpose of sleep. Shall I try killall -i chrome without any other parameter? – dragonmnl Jan 26 '16 at 11:58
  • sleep was just used to create a process (shell runs the sleep command) here. You could use any command that runs for a while - so that you get some time to kill it. You could try killall with the -v option to get more info. You could use -i to run it interactively (it should ask for input in the -i case). – jai_s Jan 26 '16 at 17:31

you can use the command top to show process


to kill process

 kill PID_of_chrome
| improve this answer | |

Chrome browser spawns several threads at startup then spawns extra threads for each window and/or tab created subsequently.

By default, killall sends a SIGTERM to all processed having a specific name ("chrome" in your case). But only the processes able to handle this signal will proceed with it. The ones that are not able to handle SIGTERM signal won't close. You can kill them unconditionally with a killall -9

| improve this answer | |
  • so, killall -9 chrome would kill all the instances, no matter if they handle or not the kill signal? Also, why would Chrome show "unexpected close" on next startup if it's actually the process to choose if accepting or not to be killed? (If I got it right?) – dragonmnl Jan 26 '16 at 11:57
  • Chromium occasionally restarts with "unexpected close" even when closed properly. – bsd Jan 26 '16 at 12:24
  • killall -9 is a rather brutal way to end a process. From a process perspective it's quite comparable to crashing the process. "unexpected close" messages are just a way for Chrome to tell that things did not end nicely on previous session. – Olivier Dauby Jan 27 '16 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.