Can I restore closed tabs after quitting Chrome?

82

51

I closed Chrome by accident. Now all the tabs I had open are presumably gone. I don't want to risk anything by starting Chrome now before asking for help. I fear that they will be permanently lost (overwritten files) if I do that. I know from past experience with Firefox that restoring tabs and browser sessions can be a tricky business.

What can I do at this point? Is there a file or something I need to copy or rename? I know about the Ctrl+Shift+T command. But I normally use this while browsing. Will this work AFTER closing Chrome?

Samir

Posted 2013-08-22T19:00:59.500

Reputation: 17 919

You can try visiting https://history.google.com/history/ where you can view ALL of your searching and tab history. You also will learn how creepy it is that Google knows all this.

– Tim Eckel – 2016-05-17T12:55:56.633

2Chrome will allow you to open recently closed tabs. If you have several tabs open it will allow you to restore all those tabs. If that history is lost, then you are out of luck, the recently closed tabs history is limited to a certain amount and replaced as needed. Just copy the profile folder, all Chrome files, are stored there. – Ramhound – 2013-08-22T19:03:12.957

I know in firefox there is a slection: Menu -> History -> Re-Open previous session. Chrome may have something similar – Shade – 2013-08-22T19:03:27.420

Oh no! I was too fast! I started Chrome to see what will happen. Because in this Chrome blog post it says On the bottom of New Tab page, the most recent few are listed in the "Recently closed" section. You can even use this after restarting the browser, in case you accidentally quit with something important open. But my Chrome version is too new! I don't have that option! Is it too late now to save the Chrome profile? Should I try restoring the tabs with Ctrl+Shift+T?

– Samir – 2013-08-22T19:08:30.377

I copied %LOCALAPPDATA%\Google\Chrome\User Data now. I hope it's not too late... I had to skip the files Current Session and Current Tabs. – Samir – 2013-08-22T19:11:53.530

I promise you the option is there ALL recent versions have it – Ramhound – 2013-08-22T19:25:01.297

Phew!! Saved... thanks guys! It did cost me some reputation points, but I will make up for that. I hope my answer will be helpful to someone. – Samir – 2013-08-22T19:37:16.947

The one thing to keep in mind is that Chrome tends to only re-open the last window open, so if you had multiple tabs in multiple windows, use the methods outlined below in Synetech's answer & cross your fingers. – Debra – 2013-10-28T03:02:08.737

Answers

98

Accidental Closure Prevention

I closed Chrome by accident.

Yes, unfortunately the devs have chosen not to build in a prompt to prevent this. You’ll have to tray out some of the extensions that have been written to deal with this and pick one that suits you (unfortunately, due to Chrome’s design, the extensions will need to keep an extra couple of processes running to work).

Data-Loss Prevention

Now all the tabs I had open are presumably gone. I don't want to risk anything by starting Chrome now before asking for help. I fear that they will be permanently lost (overwritten files) if I do that.

Very smart. You are correct, that running Chrome will likely wipe them out soon after because it is designed to keep only one set of backups in addition to the current, working copy, so when you start a new instance, it will shift everything back and overwrite the previous one.

I know from past experience with Firefox that restoring tabs and browser sessions can be a tricky business.

It’s not pleasant with Chrome either, but I’ll walk you through the process (I’ve had to do it far too many times).

Session Files

What can I do at this point? Is there a file or something I need to copy or rename?

Yes, they are the following four files in your User Data Directory:

  • Current Session (contains the data from forms in the pages in the current session)
  • Current Tabs (contains a list of URLs for the tabs in the current session)
  • Last Session (same as Current Session, but for the previous session)
  • Last Tabs (same as Current Tabs, but for the previous session)

(Note that the term “session” here implies a round of starting Chrome from scratch. That is, if you open Chrome when there are absolutely no instances of chrome.exe running (check the Task Manager to be sure), then you are starting a session. If you close all tabs in a window, but have another Chrome window with a tab open, then that session is still active, so starting Chrome again will not be a new session. Likewise, if Chrome hangs and you close all windows but there remains a copy of chrome.exe running, then that session is still active until you kill it.)

Copy these four files somewhere so that you can work without losing anything. That way, you can always copy them back if something goes wrong.

Reopen Tab(s)

I know about the Ctrl+T command. But I normally use this while browsing. Will this work AFTER closing Chrome?

Yes, to some degree, however you have the combo wrong; it’s Ctrl+⇧ Shift+T. And if you had multiple tabs open before closing it, then it should re-open all of them.

(In older versions, for some reason, it would only work if you first created a new tab. I still use Chromium 11 on my XP system and am always baffled by this strange behavior. Whenever I close Chrome accidentally and need to recover my tabs, I first have to open a tab (pressing Ctrl+T for the New Tab Page is easiest) before pressing Ctrl+⇧ Shift+T to get the previous tab(s) back. In newer versions (I’m not sure exactly when, but for numerous versions now), it works without having to open a tab first.)

Now before you go and run Chrome, I have to warn you that it does not always work. First of all, it won’t work immediately after launching Chrome. You have to wait until Chrome reads the user files and parses them. This can take a few moments and you can see it by right-clicking the tab-bar and observing that the Reopen closed tab context-menu entry is grayed/disabled for a while. If you wait a few moments and repeat, it should turn black (enabled) and then you can use it.

However, even if you wait a while, it will not always restore the previous session. Sometimes, Chrome simply loses the previous session and tabs and the reopen-tab function just won’t work. I have not been able to figure out why or discern any sort of pattern or cause, but it always seems to be the case when you need it the most. I haven’t done clinical, experimental tests, but it seems that opening a new tab after launching it is a good way to get Chrome to wipe out your previous session (I guess it figures that you are done with it and starting something new).

In case this ends up happening, I recommend copying the four files above before running Chrome again. That way you won’t lose them if Chrome is in a bad mood and decides to wipe them out.

Copy the files, then run Chrome and wait a few moments, then see if reopen-tab is available.

Recovery Mode

If it's still not available, try putting Chrome in recovery mode:

  1. Close Chrome
  2. Copy the backup of the four files back to your User Data directory
  3. Open the Local State file in a text-editor (it is in the parent folder of User Data)
  4. Locate the exited_cleanly entry
  5. Change it to false
  6. Save and exit
  7. Run Chrome

Now it should display the Chrome didn’t shut down correctly notice bar. Click the [Restore] button, and hopefully it will restore your session. (This should work even if you have opened new tabs before clicking the button.)

If it doesn’t work, try copying Last Tabs and Last Session to the User Data Directory and renaming them to Current Tabs and Current Session respectively. Of course even if this works, you will only be getting the session before the previous one, not the one that crashed, but that may be sufficient depending on your situation.

Chrome’s improper shutdown notice

Manual Extraction

If that still doesn’t work, then you can manually extract the tabs from the files by using a string-searching program like Strings (go figure). Run the program, passing it the files and save them to another file. Most such programs require using the command-line, but presumably there are GUI versions as well (though I can’t seem to find any at the moment). So for example, if you save strings.exe to c:\foobar and copy the four files to there as well, you could extract the tabs as so:

C:\foobar>strings "current tabs"    > ctabs.txt
C:\foobar>strings "last tabs"       > ltabs.txt
C:\foobar>strings "current session" > csess.txt
C:\foobar>strings "last session"    > lsess.txt

(I added extra spaces to align everything just to make it clear what is happening.)

Now you can open the new *tabs.txt text files and see the URLs of the tabs you had open before. Note that you may see a lot of duplication as well as some tabs that you had closed.

The *sess.txt files will contain other information like text that you had typed into forms on a page, so if you had a page open with a bunch of information that you had entered, you can recover that so that you don’t have to start all over again from scratch. (For example, if I accidentally close this page, I could recover this text that I am typing at this very moment instead of trying to do it all again. The horror! ๏_๏) Note again that you will likely see duplication. The worst part is that if you had been typing something for a while and it has changed numerous times since you started (like this text here), then you will probably find several copies of it, each one a snapshot at different points. This can be tedious to examine each file to see which is the most recent version with the latest changes; but it’s still better than starting over from scratch.

Future Session Management

To avoid having problems like this in the future (and to avoid having to rely on Chrome to work correctly), you can install a session-management extension. There are several to choose from, but I recommend Session Buddy. It works quite well, is versatile, and Hans is receptive to bug-reports and feature-requests. (I think he has recently even added syncing!) Session Buddy will let you manually save a session, but can also automatically save sessions, so you can easily recover from a crash.



Now I’ll just post this answer by clicking that red button in the corner…

Synetech

Posted 2013-08-22T19:00:59.500

Reputation: 63 242

1

I was unable to find the suggested "Session Buddy" in the chrome web store but I did find a very promising contender: Tabs Outliner.

– Tim Lewis – 2014-08-28T12:40:05.540

1This didn't work for me recently, but restoring the entire User Data Directory from backup did. – Theodore Hong – 2014-12-03T23:35:23.150

"tab snap" also worth a look for manually saving large number of tab sessions https://chrome.google.com/webstore/detail/tab-snap/ajjloplcjllkammemhenacfjcccockde

– Amos Folarin – 2015-01-07T13:59:00.210

Session Buddy cannot be downloaded,nor did tab snap. – zionpi – 2015-01-28T06:58:52.930

How come this is highest upvoted and accepted answer? It's much more simple than that - http://superuser.com/a/784706/101043.

– Neolisk – 2015-08-28T11:39:17.850

@Neolisk That solution doesn't work if you had large amount of tabs, at least for me – Abdul – 2016-02-28T04:25:17.033

2Wow! I don't know what to say... except... thanks! Nice work! – Samir – 2013-08-22T20:04:24.360

No problem, happy to help. Like I said, I’ve been there several times. – Synetech – 2013-08-22T20:21:15.533

2One way to break the session restore (Which I just accidentally did) is to chromium-browser --incognito to "quickly read just a small something without invoking the session-restore facilities" (for a large browsing session). Then hit ctrl+n instead of ctrl+N. The new window will erase the session. – isomorphismes – 2013-09-30T20:04:12.110

Hey, just requesting a little clarification. Is @Sammy's addendum in his answer below an equally effective solution for future session management? Maybe changing settings should be mentioned in your final section, too? Maybe not. Just curious of your thoughts here. – samthebrand – 2013-10-25T01:16:58.507

1@SamtheBrand, that setting does exactly the same thing as manually selecting Reopen… right after starting Chrome does; it just does it automatically. It has no special functionality to make it more effective at recovering a crashed session, so it is subject to the same limitations as doing it manually, therefore if Chrome had crashed, it may or may not work. Most people won’t want to restore all tabs they had open last time, so this is only useful if you crash frequently. It is still better to use a dedicated session-management extension, especially one that auto-saves like Session Buddy. – Synetech – 2013-10-25T15:52:44.290

@Synetech Thanks for the clarification. Really helpful. – samthebrand – 2013-10-25T15:58:24.283

6

Yes, you can!

But first things first, copy %LOCALAPPDATA%\Google\Chrome\User Data to a safe location.

Then, start Chrome and right click on the Tab bar and choose Reopen closed tab.

restore closed tab

But don't take my word for it. This is guaranteed to work on Chrome version 29.0.1547.57 m. For other versions, check your users manual.

To prevent this problem in the future, change the Chrome settings. Click on the Chrome menu button in the upper right corner of your browser, then click Settings. Where it says "On startup" choose the option Continue where I left off. This way, even if you close Chrome intentionally, when you start it the next time it will show you the tabs you had open previously, for each and every time you close and start it again.

Note however, that unlike Firefox, Chrome will try to load each webpage for each and every open tab. If you have a slow computer or you have many tabs open this could be a problem. It can also affect your bill if you have dial-up connection (let's face it; not every Internet user in the world has dedicated Fiber-LAN connection).

Samir

Posted 2013-08-22T19:00:59.500

Reputation: 17 919

Thank you so much, this is the only solution that actually worked. – OhadM – 2016-02-05T12:16:34.377

You can also use the Ctrl+Shift+T command. But as always with keyboard shortcuts, you can make mistakes fairly easy, i.e. press the wrong key combination. If you e.g. manage to add in some W to the mixture you could end up closing the program window, and I'm not sure Chrome will allow you to restore the tabs after a second start. It would probably restore from the last browser session (not the one before that), that is to say your last single (New Tab) tab. – Samir – 2013-08-22T19:47:45.287

You don’t need to copy the whole User Data folder, that can be quite large, so copying the entire thing would be a waste. ;-) – Synetech – 2013-08-22T19:54:29.447

This option has been there since before Chrome version 29.0.1547.57 m so your statement about it not being guaranteed to work is incorrect and thus not helpful. – Ramhound – 2013-08-22T20:05:43.157

@Synetech Yeah, so I noticed! ;) It's 551 MB! Only the files that live inside Chrome\User Data then? None of the subfolders or any of the other files? – Samir – 2013-08-22T20:08:38.813

@Ramhound Can you tell me the version in which they included this option? – Samir – 2013-08-22T20:10:04.180

@Ramhound I have excluded the "only" part and added another sentence. I think it's flexible enough now. =) – Samir – 2013-08-22T20:12:58.393

@Sammy, only 551MB? That’s not too bad. :^Þ   Actually, you only need the *tabs and *session files (very small).

– Synetech – 2013-08-22T20:25:43.047

@Ramhound, stop down-voting Sammy for saying it doesn’t always work! They never said it won’t work because it’s not available, they said it’s not guaranteed to work because it doesn’t. Yes, it’s been there forever, but that doesn’t mean it works correctly all the time. Sometimes the option is disabled for some unknown reason, other times it only restores a single tab, yet other times it restores just the home page. Also, saying that it’s only guaranteed to work on their version doesn’t mean that it won’t work on other versions, only that they can’t vouch for other versions. – Synetech – 2013-08-22T20:29:37.247

@Synetech In stopped allowing Chrome to handle its own session for awhile now and trust extensions to sync my open tabs with Xmark and session extensions to save my open tabs chrome has serious problems with its session handling. – Ramhound – 2013-08-22T21:04:20.863

Indeed.​​​​​​​​ – Synetech – 2013-08-22T21:09:28.393

4

when you open a fresh chrome window the first thing you do is to select the 'History' page from the menu. When you are in the history tab, you hit the usual Ctrl+Shift+T and it restores the previous session in a new window.

I used this both after having killed the browsing session and after properly closing the browser window with recent versions of chrome and chromium on linux.

This answer is obviously much more simplistic than the accepted one, but I found this to work reliably.

Erik

Posted 2013-08-22T19:00:59.500

Reputation: 226

This is the best answer to the question and still works in the latest v37 of Chrome. – kenck – 2014-10-03T18:53:43.707

3

Click the Recent Tabs submenu in the three-bar menu. Then restore each group of tabs (which should correspond to your previous windows) one by one. Hopefully you didn't have too many windows open...

Robin Green

Posted 2013-08-22T19:00:59.500

Reputation: 1 107

This doesn't seem to work if you had a large amount of tabs, at least for me – Abdul – 2016-02-28T04:24:48.000

2

Once this happened to me after cleaning my notebook with CCleaner. What I did was somewhat simple but worked fine. I entered into the Chrome History and looked for the entries for the last few days and I could restore all tabs I wanted to. Hope it helps someone in the future Carlos Moura Brazil

Carlos Moura

Posted 2013-08-22T19:00:59.500

Reputation: 21

That can help if Chrome’s crash recovery doesn’t work, but it has limits: pop-up windows won’t be listed in the history, form contents won’t be retained, if you have a lot of tabs open, that can be a pain. Also, the history will not list the tabs you had open at the top, it will have them spread out among a bunch of other tabs that you had closed before the crash, so it becomes a lot of work to figure out which were open and which were not. :-( – Synetech – 2013-12-17T17:10:01.260

Also, if you opened page A, and then navigated to pages B and C in the same tab, won’t History show A, B, and C? This will also complicate the task of identifying which pages were open when the browser terminated. – Scott – 2013-12-17T22:59:36.233

1

I just open the Task Manager and end the Chrome process with the highest RAM usage and it'll close the browser along with all the tabs.

The next time that I open Chrome, it'll ask me if I want the restore the tabs from the previous session. Voila! All tabs are restored.

I find this works only if I open Chrome as administrator each time.

Ele

Posted 2013-08-22T19:00:59.500

Reputation: 11

1

Here's what worked for me. Go to:

C:\Users\your_username\AppData\Local\Google\Chrome\User Data

Right click on the Default folder -> Properties -> Previous versions -> Restore it to the most recent version (prior to losing your tabs).

Magic! (It might give you some errors for restoring some cache files, just ignore/skip them.)

The other options, such as Ctrl+Shift+T or replacing the "current session" and "current tabs" files with the "last session" and "last tabs" files, didn't work for me because my "last session" and "last tabs" files had already been rewritten after losing the tabs.

Restoring a previous version of the folder did the trick (though you may not be able to restore some of your most recent tabs - but chances are you'll remember what they were since they were recent).

terrorist96

Posted 2013-08-22T19:00:59.500

Reputation: 81

Thanks! If you happen to have a good restore point, then this is certainly one of the easiest methods after completely losing a session. To reduce the chance for errors, make sure to close chrome and the chrome background app before running the restore. – pschueller – 2014-09-25T08:01:57.663

1

If you have already restarted Chrome and restored these tabs in the past, then I think these tabs will show up in your browsing history, in the same order they had been in before. Just open the history page, scroll back to the date/time when you last successfully restored the tabs, and you should see them all there grouped together.

Of course, this assumes that most or all of the tabs have stayed open through multiple sessions, and that you don't delete your history on a regular basis.

user350095

Posted 2013-08-22T19:00:59.500

Reputation: 11

1

Because the proposed config setting of exited_cleanly = false didn't work for me, and I found no equivalent of strings for Linux, I found another solution.

  1. Backup Current tabs and Current session, if you still have them (best: also Last...)
  2. Start chromium
  3. Find out PID (process id) of chromium, f.e. by ps a | grep chromium (number in first column) or htop, /, type chrom...
  4. Kill chromium via command line, f.e. kill -s SIGILL <PID>
    • Now, behold: you have created a reason for chromium to think, it has crashed. (Which created some files also on my computer, not only the exited_cleanly thing.)
  5. Copy your backup of Current tabs and Current session to ~/.config/chromium
  6. Restart chromium as usual
  7. Restore! Hurray!

PythoNic

Posted 2013-08-22T19:00:59.500

Reputation: 157

2strings is a standard Linux command - you should have it installed by default. – Robin Green – 2016-12-18T08:44:33.720

1why not just pkill chromium – jaam – 2018-01-15T03:19:40.020

SIGILL should presumably be SIGKILL (of course, I can't fix it because edits must be at least 6 characters...) – Soren Bjornstad – 2019-12-30T18:59:23.277

0

To everyone reading, I greatly recommend downloading the Great Suspender Chrome Extension. It doesn't just optimize your memory usage (basically puts the tabs you haven't used for a while out of memoty, but still inside Chrome), but it also stores your browsing "sessions". So even if the Chrome wiped everything out, you can go to the GS's settings and all your sessions would be there - and easy to export in a text file.

parsecer

Posted 2013-08-22T19:00:59.500

Reputation: 133

0

Would like to add that, Pinned tabs will reopen automatically when you start chrome next time.

Also when you hit Ctrl + Shift+T all previous session tabs will open in a new chrome browser window (tabs will not be added to existing browser window).

Abdullah Leghari

Posted 2013-08-22T19:00:59.500

Reputation: 248

"Also when you hit Ctrl + Shift+T all previous session tabs will open in a new chrome browser window". That's not what Ctrl+Shift+T does normally. It just reopens the last closed tab in an existing window. Are you talking about immediately after starting Chrome? – Robin Green – 2016-12-18T08:38:34.230

-2

the simple short cut is Ctrl+Shift+T and you can recall all your open tabs....

Waseem

Posted 2013-08-22T19:00:59.500

Reputation: 1

1No. This only works if you don't close the browser. Which is not what the question is on about – random – 2013-12-17T21:31:11.850