3

Possibly related to this question: Can I view Firefox history with the terminal?

I want to create a shell script that clears everything in my Firefox's history (this includes the other histories such as cache) in order to have a clean copy to backup before installing the next Ubuntu version or just to have. The question is how to do this via command line so I can add those lines to my script.

I'm okay with a command line command via BleachBit also, if possible.

  • What about having a backup copy of the empty default places.sqlite, formhistory.sqlite and downloads.sqlite and just replacing the files in use with the default files with a simple cp SOURCEFILE TARGETFILE? – Byte Commander Sep 7 '15 at 17:02
3

This short command cleans Firefox backups, cache, cookies, crash reports, DOM storage, download history, form history, passwords, session restore, site preferences, and URL history (as of BleachBit 1.8):

bleachbit --clean firefox.*

(See also BleachBit documentation: command-line)

  • shouldn't it be firefox.\* and firefox has to be closed for that? – user359096 May 23 '18 at 7:43
  • @randomware: from the command line I have been typing firefox.* without the slash, and it always works. Yes, the Firefox process should be closed, and BleachBit will throw an error if it is not closed. – Andrew May 23 '18 at 12:18
1
  • This link tells you where your history.dat is located in your profile and so you can delete that.

    Browsing History: history.dat
    Saved Form Information: formhistory.dat
    Download History: downloads.rdf
    Cookies: cookies.txt
    Cache: cache (& trash cache) (folders!)

  • To find your profile folder: Go to Help menu, Troubleshooting information. Near the top will say "Profile Folder" and a button called "Show Folder".

  • The same troubleshooting info is available via the URL: about:support. Just type that in the address bar.
1

If you want to erase the history from Firefox, use cd in the Terminal to where all the sqlite files are stored, following the instructions in the link you provided. The following code will erase the relevant table:

sqlite3 places.sqlite "DELETE FROM moz_historyvisits;"
  • Chris, modern browsers keep history in literally dozens of places that keep changing with each browser version, so it is not sufficient to delete history from a single location. Also, I believe that command will damage bookmarks. These are reasons why BleachBit is useful because it does this work for you. – Andrew May 23 '18 at 12:20

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.