How to read your Firefox history from the terminal

Want to know a bit more about your browsing history? Here are some simple oneliners to view essential information.

I have a very short long-term memory, so every time I want to look at my browsing history, I have forgotten again how to do it. This is really a note to myself, but I thought others might find it helpful too.

Note: this is for people using Firefox under Linux.

In order to see your Web history sorted by date, do:

sqlite3 ~/.mozilla/firefox/*default/places.sqlite "SELECT datetime(moz_historyvisits.visit_date/1000000,'unixepoch'), moz_places.url FROM moz_places, moz_historyvisits WHERE moz_places.id = moz_historyvisits.place_id"|sort|less


A list of unique urls you have visited can be obtained with:

sqlite3 ~/.mozilla/firefox/*.default/places.sqlite "SELECT url FROM moz_places"|less


See how many unique URLs you have visited (excepting queries to search engines and access to local files):

sqlite3 ~/.mozilla/firefox/*.default/places.sqlite "SELECT url FROM moz_places"|sort -u|egrep -v "duckduckgo|google|^file:|localhost:"|wc -l


If you want to know more, this page has great information about the structure of the sqlite Firefox history.