How can I stop accumulated Google Chrome background processes?

28,021

Solution 1

A grab-bag of chrome poisons:

pgrep chrome | xargs kill # this is basically "pkill chrome"

Same thing, but sleep for 1/3 of a second in between:

for i in `pgrep chrome` ; do kill $i ;  sleep .33 ; done

Keep on killing 'til the killing's done :

while pgrep chrome ; do pkill chrome ; done

Short and sweet (but won't exit until you exit manually) :

watch pkill chrome 

Might work? :

for i in `pgrep chrome` ; do kill $i && wait $i ;  sleep .33 ; done

Solution 2

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.

Solution 3

I think that not all of those are processes, but are rather threads.

You tried killall -15 google-chrome chrome? That should kill all google-chrome processes and threads with a SIGTERM signal. If that doesnt work, you can always try killall -9 google-chrome chrome (HIGHLY NOT ADVISED Unless you ABSOLUTELY need to kill the processes without them saving data)

Solution 4

Try this?

kill $(ps -C google-chrome -o pid=)

Solution 5

You can try:

pkill chrome

Seems like I need 5 extra characters...

Share:
28,021

Related videos on Youtube

RusGraf
Author by

RusGraf

My goal here is usually to document.

Updated on September 17, 2022

Comments

  • RusGraf
    RusGraf almost 2 years

    Sometimes invisible instances of Google Chrome accumulate and prevent me from starting the browser:

    $ ps -ef | grep chrome
    ak        4044     1  4 11:30 ?        00:00:01 /opt/google/chrome/google-chrome
    ak        4047  4044  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4049     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
    ak        4139  4044  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4044.0x618d838.1464152706 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
    ak        4150     1  3 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4153  4150  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4155     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
    ak        4244  4150  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4150.0x48c1e38.1952918361 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
    ak        4253     1  6 11:30 ?        00:00:01 /opt/google/chrome/google-chrome
    ak        4256  4253  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4258     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
    ak        4348  4253  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4253.0x598ca38.734301885 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
    ak        4355     1  4 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4358  4355  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4360     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
    ak        4449  4355  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4355.0x4bb6e38.554350998 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
    ak        4457     1  5 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4460  4457  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4462     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
    ak        4553  4457  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4457.0x5338c38.1605325542 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
    ak        4559     1  8 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4562  4559  0 11:30 ?        00:00:00 /opt/google/chrome/google-chrome
    ak        4564     1  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=zygote
    ak        4653  4559  0 11:30 ?        00:00:00 /opt/google/chrome/chrome --type=plugin --plugin-path=/home/ak/.config/google-chrome/Default/Extensions/cpngackimfmofbokmjmljamhdncknpmg/3.0.7_0/plugin/screen_capture_64.so --lang=en-US --plugin-data-dir=/home/ak/.config/google-chrome/Default --channel=4559.0x60e6638.1319164624 --enable-crash-reporter=D8EC5832E6B1783FEA1F118FC4B1AAE0,Ubuntu 10.10
    ak        4661  4020  0 11:30 pts/2    00:00:00 grep --color=auto chrome
    

    If I try to start Chrome while these are present, the following error message is displayed:

    Your profile could not be opened correctly.

    Some features may be unavailable. Please check that the profile exists and you have permission to read and write its contents.

    Short of logging out of Ubuntu, how can I get rid of these to allow Chrome to start again? My first guess didn't work as I expected:

    $ killall google-chrome
    google-chrome: no process found
    

    Running kill on each process two times in a row gets the job done:

    $ kill 4044 4047 4049 4139 4150 4153 4155 4244 4253 4256 4258 4348 4355 4358 4360 4449 4457 4460 4462 4553 4559 4562 4564 4653
    $ !!
    kill 4044 4047 4049 4139 4150 4153 4155 4244 4253 4256 4258 4348 4355 4358 4360 4449 4457 4460 4462 4553 4559 4562 4564 4653
    bash: kill: (4139) - No such process
    bash: kill: (4244) - No such process
    bash: kill: (4348) - No such process
    bash: kill: (4449) - No such process
    bash: kill: (4553) - No such process
    bash: kill: (4653) - No such process
    

    but I would love to have a less cumbersome solution.

    • Admin
      Admin over 13 years
      You don't have to kill the processes twice. According to your output, the processes don't exist when you execute the command a second time.
    • Admin
      Admin over 13 years
      @George The six listed processes don't exist, but the rest are still present after the first kill command.
  • RusGraf
    RusGraf over 13 years
    This did not kill any processes.
  • Javier Rivera
    Javier Rivera over 13 years
    Have you tried to give it some more time?
  • RusGraf
    RusGraf over 13 years
    Is there a difference between killall and killall -15?
  • Thomas Ward
    Thomas Ward over 13 years
    killall without any arguments automatically uses signal 15 which is SIGTERM, however i'm always in the habit of specifying which code the system should use to send to the process(es)