Documenting Problems That Were Difficult To Find The Answer To

Really Clean Up Firefox Cache

I’m using Firefox 8 (by the time you read this blog the version number may well be something far greater, 25 or 26, 100? Why didn’t they just keep calling it 2.x or 3.x? Absurd!).

When you press ctrl-shift-delete and clear all history for all time for the cache or history are you surprised to find that detailed information is still kept in D:\Users\username\Application Data\Mozilla\Firefox\Profiles\profilenumber.default\places.sqlite for example?

The truth is that Firefox merely instructs the database to mark entries as deleted – but they are not actually removed from the file. You have to perform what is known as a “VACUUM” on the file – which rebuilds the database file from the existing – but more compact and without the data you thought you deleted.

So how do you do this “VACUUM” command? You need to download a program called sqlite3.exe (for Windows) or build your own sqlite3 for unix/linux. See the sqlite website for more details.

Once this program is in your PATH you can scan your disk drive for all *.sqlite files and perform a “VACUUM” on them.

Microsoft Windows

Copy and paste the following text into a file called cleanup_sqlite.bat:

@echo off

for /f "delims=" %%a IN ('dir /s /b *.sqlite') do call :doit "%%a"

goto EOF


echo --- %1
H:\utils\sqlite3 %1 VACUUM

goto EOF


Then start a command line process (e.g. press Start -> Run -> type cmd.exe and press enter). Change to the drive you want to scan (usually C: but sometimes D: in corporates) – and type cleanup_sqlite and this script will search for sqlite files to VACUUM.

If you see the following message:
  Error: database is locked
then consider closing your browser before running the script another time.

It doesn’t hurt to run this batch file multiple times.


It is much easier to use the find command to find .sqlite files to process. The following script should do it:


find . -type f -name '*.sqlite' \
    |xargs -I{} \
    nice sh -c "echo \"{}\"; sqlite3 \"{}\" VACUUM"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: