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.

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_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

This page has great information about the structure of the sqlite Firefox history: