I really got to love the Smartbar aka Awesomebar, introduced in Firefox 3. But in some way it annoyed me that there is no really obvious way to remove entries from it. Sure, after a bit of research via Google I found out, that you can press shift+delete while hovering with your mouse over an entry. But this doesn't help much if you want to get rid of all entries for a given domain or containing a specific keyword - so this may get kind of tedious. It also seems, that there isn't even a single Add-on which can deal with this. If I missed something, please drop me a quick note.
Nevertheless, being a part-time hacker I also couldn't overlook, that Firefox is saving lots of the data it stores on your workstation in SQLite databases. And where is SQL, there is rescue!
So, first step - where are those database files? On Mac OS X, they are usually located in
~/Library/Application\ Support/Firefox/Profiles/<some string>.default/
The one you want to hassle with is named
Note, from now on you have to work while Firefox isn't running. Otherwise, the SQLite database is locked and you can't access it. But let's get to business - we're interested in the following table:
- fh$ sqlite3 places.sqlite
- SQLite version 3.4.0
- Enter ".help" for instructions
- sqlite> .schema moz_places
- CREATE TABLE moz_places (id INTEGER PRIMARY KEY, url LONGVARCHAR, \
- title LONGVARCHAR, rev_host LONGVARCHAR, visit_count INTEGER DEFAULT 0, \
- hidden INTEGER DEFAULT 0 NOT NULL, typed INTEGER DEFAULT 0 NOT NULL, \
- favicon_id INTEGER, frecency INTEGER DEFAULT -1 NOT NULL, \
- Â last_visit_date INTEGER);
- CREATE INDEX moz_places_faviconindex ON moz_places (favicon_id);
- CREATE INDEX moz_places_frecencyindex ON moz_places (frecency);
- CREATE INDEX moz_places_hostindex ON moz_places (rev_host);
- CREATE INDEX moz_places_lastvisitdateindex ON moz_places (last_visit_date);
- CREATE UNIQUE INDEX moz_places_url_uniqueindex ON moz_places (url);
- CREATE INDEX moz_places_visitcount ON moz_places (visit_count);
The url column holds the complete URL Firefox shows in the Smartbar, so we can simply write a quick query:
- sqlite> SELECT url FROM moz_places WHERE url LIKE '%bbc.co.uk%';
If I wanted to get rid of them this query would do:
- DELETE FROM moz_places WHERE url LIKE '%bbc.co.uk%';
Replace the domain accordingly, backup your places.sqlite before changing anything and you're good.
The location of places.sqlite on other OS:
C:\Documents and Settings\<username>\Application Data\Mozilla\Firefox\ Profiles\<profile folder>\places.sqlite
C:\Users\<user>\AppData\Roaming\Mozilla\Firefox\Profiles\ <profile folder>\places.sqlite
If you're on an OS which doesn't ship with any SQLite interface, go to the SQLite website and download it. Or, if that is to much hassle for you, there is a Firefox Add-on, called SQLite Manager, which can access and change SQLite databases too. But remember: you have to work on a copy of places.sqlite as the file is locked while Firefox itself is running.