34

Google Chrome usually has 8 to 9 processes running, even though only one window is open. Which one of these processes do I kill to safely close the Google Chrome window?

Here is my ps -Af | grep chrome output:

1000      2706     1  2 23:01 ?        00:00:52 /usr/bin/google-chrome-stable
1000      2713  2706  0 23:01 ?        00:00:00 /usr/bin/google-chrome-stable
1000      2714  2706  0 23:01 ?        00:00:00 /opt/google/chrome/chrome-sandbox /opt/google/chrome/chrome --type=zygote
1000      2715  2714  0 23:01 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
1000      2719  2715  0 23:01 ?        00:00:00 /opt/google/chrome/nacl_helper
1000      2720  2715  0 23:01 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
1000      2839  2706  0 23:01 ?        00:00:08 /opt/google/chrome/chrome --type=gpu-process --channel=2706.3.250838429 --supports-dual-gpus=false --gpu-driver-bug-workarounds=0,1,27 --disable-accelerated-video-decode --gpu-vendor-id=0x1002 --gpu-device-id=0x6760 --gpu-driver-vendor=ATI / AMD --gpu-driver-version=13.30
1000      2843  2839  0 23:01 ?        00:00:00 /opt/google/chrome/chrome --type=gpu-process --channel=2706.3.250838429 --supports-dual-gpus=false --gpu-driver-bug-workarounds=0,1,27 --disable-accelerated-video-decode --gpu-vendor-id=0x1002 --gpu-device-id=0x6760 --gpu-driver-vendor=ATI / AMD --gpu-driver-version=13.30
1000      3038  2720  1 23:08 ?        00:00:28 /opt/google/chrome/chrome --type=renderer --lang=en-US --force-[...very long options list]
1000      4505  4441  0 23:40 pts/0    00:00:00 grep --color=auto chrome
3
  • 1
    By "Google Chrome window", do you mean one tab in Chrome, or the entire browser? – saiarcot895 Apr 7 '14 at 21:19
  • @saiarcot895 The entire browser. – udiboy1209 Apr 8 '14 at 7:19
  • If it is possible to close only a tab, please include that in the answer too. – udiboy1209 Apr 8 '14 at 7:22
25

For the record, killing a process from Terminal isn't considered as "safely closing Google Chrome".

To kill the entire browser, you can run killall google-chrome-stable or (in this example) kill 2706 (note how the parent PID is 1, and all of the other processes stem down from this process).

To kill a tab, I can tell that process 3038 is a tab, but not which or what tab. You can run kill 3038 to kill the process running the tab, but note that the tab itself will still be open (but the content will be replaced with a blue screen).

6
  • I thought using kill was equivalent to pressing the 'x' button. What's the difference? – udiboy1209 Apr 8 '14 at 17:31
  • 4
    No, using kill or killall instantly terminates the process(es). It doesn't give the chance for applications to do what they normally do when closing. In the case of Chrome(ium), this can mean saving the profile, settings, and history and doing a few database transactions (I'm not sure what the full list is). Note that this applies to all processes. – saiarcot895 Apr 8 '14 at 19:10
  • 1
    but kill -15 gives them a chance for that, right? – tobi Oct 20 '15 at 7:19
  • Yes, I believe using the signal 15 (SIGTERM) gives them a chance to save their info. – saiarcot895 Oct 20 '15 at 11:16
  • 3
    killall chrome worked for me on ubuntu 16.04 – MChaker Dec 20 '16 at 10:58
24

If you don’t want to see “Google Chrome didn't shut down correctly. To repoen ...”, then it is important to signal only the root of the chrome process tree, like so:

pkill --oldest chrome

See full explanation. wmctrl -c (great program) only works with some window managers like Unity, and it only closes one window at a time so you would need a loop.

1
  • 4
    in 14.10 (or different Chrome version) the naming is changed. However 'pkill --oldest chrom*' will do the job for both. – Requist Dec 16 '14 at 21:11
16

You can stop all of them with a single command:

sudo killall chrome

Then to prevent it from doinng this in the future, go into Settings, pick Advanced, and near the bottom you will find a switch where you can set it to NOT allow background processes to run when the program exits. Shut it off.

0
3

You also have an option to close the window using window manager control, but for it, you have to install a small package (tested on 14.04)

sudo apt-get install wmctrl

This procedure will simulate a click on then X button as you wished before.

wmctrl -c "Google Chrome"

The only drawback for chrome is that if the page asks for exit confirmation (like askubuntu when editing a post) this confirmation will be shown instead of the window closing.

The "Google Chrome" parameter can be swapt for any text in the window title and you can create a .sh file of this command and use it whenever you wish (in my case i wanted to simulate a windows 8 drag bottom close window feature using ccsm and hot conners)

1

As another option without using the command line is:

  1. Show Applications > System Monitor
  2. Go to the process name chrome
  3. Right click on it and choose End (or Kill)

    enter image description here

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.