![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
how can I restore / recover accidentially deleted history? Linux Mint 17 Qiana Firefox 66.0.3
accidentially I deleted the history of some months ago that I wanted to keep as it slipped down while I thought I deleted just another day. How can I restore / recover / undelete the history of a Month that I want to keep? Today I deleted (20.01.2020) ist an it was I think the history (cache) of October or sth.
Would be great if someone knows help.
Krejt Përgjigjet (12)
History and cache are actually separate things.
If you have not closed the browser yet, you may be able to find the entry if Firefox does not flush these immediately. Find your places.sqlite in your Firefox user profile and make a copy to e.g, your desktop. This contains bookmarks and history.
Type about:profiles in the address bar and Enter. Click the Open Directory button next to your profile's Root Directory entry. The file is in the root of this folder.
You can browse through this with DB Browser for SQLIte https://sqlitebrowser.org/
If you can copy the file over to a Windows machine, you can try this tool which is meant specifically to display history: https://www.nirsoft.net/utils/mozilla_history_view.html
well, I already closed the browser. Is there still a chance?
I would guess that the DB has already been flushed, but there is no harm in trying. I hope you copied the file immediately and have not opened and closed the browser several more times.
Couln't find a DB Browser for SQLIte in the Linux Mint Mate 17 packages. Sorry I did open and close it, but I always open the previous session so that the tabs and everything from the previous sesson open again.
How can I check it with the DB Browser for SQLIte on Linux?
Thank you very much.
I honestly don't know how good the prospects are, but i can't guess at the behavior of FF 68. If you want to check without using a Windows box, here is the way i am personally capable of sorting out.
Qiana has an Ubuntu 14.04 package base, so you can get DB Browser for SQL from the PPA listed on the downloads page, and it should work, unless something has changed without notice. It worked fine on 19.3 Tricia.
Just crack the terminal and do:
sudo add-apt-repository -y ppa:linuxgndu/sqlitebrowser
sudo apt-get update
sudo apt-get install sqlitebrowser
With Firefox closed: Launch the DB browser Click Open Database Navigate to wherever your places.sqlite is
-OR-
Navigate to where your places.sqlite file is Right-click the file and select Open with DB Browser for SQLite
Click the Browse Data tab For Table: select moz_historyvisits
Now, this won't look very interesting, but the dates are what we want to check.
(I mean, if you can read unix epoch time in microseconds, just scroll to the date range of interest, look at the number in the place_id column, then look that up in the moz_places table :D )
If i could do SQL, this would be less of an adventure, but here goes.
Click File → Export → Table(s) as CSV file... moz_historyvisits should already be selected. Click OK. Save this to your Desktop. Click File → Close database, then close the program.
You now have a file moz_historyvisits.csv on your Desktop. It should have a LibreOffice Calc icon. I hope.
Double-click the file. You should be greeted shortly by the Calc Text Import screen. At the bottom where it shows the file contents, you want to right-click each column and change it from Standard to Hide, except for the visit_date column. Click OK. Now you should see a spreadsheet view with only one column, the visit_date. Click File → Save As... → and append _s to the name so it reads moz_historyvisits_s Choose to save it to Desktop Click Save A modal dialog box will appear. Click Use Text CSV Format. A file moz_historyvisits_s.csv should now be on your desktop. (You can right-click this and open it in your text editor to delete the visit_date line at the top, or not. Just be aware that you didn't visit one site 1969. :D )
Open your Home folder, then right-click your Desktop folder → Open in Terminal
Copy this ↓
cat moz_historyvisits_s.csv | cut -c 1-10 | awk '{print strftime("%c",$1)}' > date.txt
and paste it into the Terminal window.
Hit Enter.
Now you will have what is probably a rather long file of dates, and hopefully you can tell whether your chunk of time is missing or not.
If your date range is present, keep your places.sqlite copy safe somewhere. Maybe someone can do SQL on the DB and fish out what you need, or maybe there are scripts somewhere that can export properly formatted history. This, or find a machine with Windows 98 or newer, and get the 32-bit MZHistory View to get your history exported.
Given that you clearly value your Firefox profile from deep-time, i highly suggest backing up the entire profile occasionally. Most definitely do so if you ever upgrade your Firefox or OS.
thank you very very much. Ich installed the sqlitebrowser and opened it. As I wasn't able to find any files you mentioned, I tried "/home/{user}/.mozilla/firefox/ but there are only 3 files like seen in the screenshots. But I couldn't find any "places.sqlite"
I also tried the same with the browser closed.
I suggested you move a copy of this file to your desktop before... Now you have been using it for days. I wish you would have said immediately when you could not find it. This is the last thing you want to do with anything deleted when you are hoping for recovery. You stop using the file (or disk, or whatever the relevant thing is) immediately, because deleted data gets overwritten.
It's in your picture.
Yes you probably cannot browse to the file with DB Browser for SQLite while it is still in a hidden directory.
Thank you very very much. Sorry... I finally managed to pull it to my desktop. It didn't let me copy it. When I klick it, "unvalid data format" pops up.
You need to right-click → Copy → select an empty spot on a folder or on your desktop → paste.
You should also be able to right-click → Open with "DB Browser...", but you really do want a separate copy of the file.
Note: If the only copy is now on the desktop, Firefox will create a new, empty places.sqlite in the Firefox profile folder the next time Firefox is started, so that will likely need to be replaced with a copy from the one on your desktop.
When I klick it, "unvalid data format" pops up.
Is this a Mint dialog, or a dialog box from DB Browser? I am not sure why you would get this message.
places.sqlite doesn't get recreated when you make changes to bookmarks or history, but merely the content of the current file is rewritten (replaced) with newer data, so once the transaction has been written to places.sqlite then this deleted history is lost. Since there is only one copy of this file available there is nothing to recover.
It will be recreated if it is removed from the directory.
Initially i had hope that the transaction was not actually written into the DB yet (at the time) but i can't see that being the case now. It does keep a table of deleted bookmarks, only i have no idea when the DB actually gets flushed. Its behavior with cookie/site data is atrocious (unless that is somehow only the front end) so it would not surprise me if there had initially been a dirty DB which could have offered some recovery.