Clearing Firefox History via Command Line

13,433

Solution 1

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)

Solution 2

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;"

Solution 3

  • 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.
Share:
13,433

Related videos on Youtube

Kailash Gaur
Author by

Kailash Gaur

She is Svetlana, a creative folk who uses Ubuntu Linux, who likes to learn about world and community building, Linux.

Updated on September 18, 2022

Comments

  • Kailash Gaur
    Kailash Gaur over 1 year

    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.

  • Admin
    Admin almost 6 years
    shouldn't it be firefox.\* and firefox has to be closed for that?
  • Andrew
    Andrew almost 6 years
    @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
    Andrew almost 6 years
    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.
  • xCovelus
    xCovelus about 3 years
    Andrew, it just worked for me in Ubuntu 20.04, CentOS 8, and a recent Firefox. Thank you, Chris, it worked for me.