1

How to kill chrome under Linux so that it'll resume/restore the sessions when it is started next time?

It's a trivial thing to do under Windows, but under Linux, no matter how I tried to kill chrome, on next start, it forgets all the old sessions as if nothing happened.

xpt
  • 1,182
  • 2
  • 13
  • 32
  • When I kill it with pkill it restores previous session. Stupid question, but have you enabled session restore in chrome ? – golder3 Oct 25 '21 at 21:34
  • Can you elaborate more please @golder3. Did you mean "Continue where you left off" as the following answer too? – xpt Oct 26 '21 at 01:26
  • Yes, that's what I've meant. In Firefox it's called "restore previous session" if I remember and in Chrome "continue where you left off" – golder3 Oct 26 '21 at 08:31

1 Answers1

1

Go to your settings page and onStartup turn on "Continue where you left off" option. In your browser

chrome://settings/onStartup

Menu for On startup

[Oct 29,2021 update] In a command session (your shell of choice: sh, bash, csh, ksh, etc.), find the root PID of your process through

ps -fea |grep -i chrome

this will get you back all the chrome process fired up by chrome, in order to find the root process with one of the chrome processes id do

pstree -pH 515333 | grep -i chrome |head
           |-plasmashell(5259)-+-chrome(515311)-+-cat(515317)
           |                   |                |-chrome(515328)---chrome(515354)-+-{chrome}(515389)
           |                   |                |                                 |-{chrome}(515390)
           |                   |                |                                 |-{chrome}(515391)
           |                   |                |                                 |-{chrome}(515392)
           |                   |                |                                 |-{chrome}(515393)
           |                   |                |                                 |-{chrome}(515394)
           |                   |                |                                 |-{chrome}(515395)
           |                   |                |                                 |-{chrome}(515397)
           |                   |                |                                 |-{chrome}(515398)

This will give you the first part of the tree of processes related with chrome (if you want all the processes related with chrome remove head command), select the starting process and do a killl -9, in this case

kill -9 515311

start chrome again and it will ask if you want to restore your session.

Moises Najar
  • 121
  • 6
  • BINGO!!! Stupid me :) -- all my setting are synced between machines, and I don't know that this particular setting is not synced. Thanks a lot! – xpt Oct 26 '21 at 01:21
  • Hold on, this "Continue where you left off" is not the restore sessions that I talked about, which is available _only_ when the previous session was ended abnormally. In fact, that's the same setting I have in Windows as well. But, I guess it'll do as well. – xpt Oct 26 '21 at 01:25
  • @xpt, I apologize for having misunderstood your question, however, I've performed the following test ps -fea | grep chrome I know that there is a command that shows the processes tree, but I don't recall it at the present moment, after that I followed the process string to find out the parent process and did: kill -9 XXXX XXX stands for the main parent process id that I found. After that I started Chrome again and it asked me if I wanted to restore my session (25 tabs) and did it as expected. HTH and if this does not work please let me know. – Moises Najar Oct 26 '21 at 17:14
  • Ah, yes, it works for me as well. THX! Would you like to amend your answer to include this part as well pls? For the command that shows the processes tree, did you mean `pstree -p`? – xpt Oct 27 '21 at 01:23
  • 1
    @xpt, I'm glad to know that it worked, thanks for the command that I was not able to recall, I tested it and in order to find the root process of chrome I did a ps -fea along with grep and after that I used pstree -pH XXXX to be able to find the root chrome process. Thanks a lot for your feedback regarding this issue. – Moises Najar Oct 29 '21 at 19:12