Sometimes I want to visit a website whose URL I can’t recall. I’m left with two options:

  1. Use cumbersome-GUI’sh browser history tool
  2. Query the local firefox database

I pick option 2 any day. The DB is a sqlite and i can use regex to find stuff much faster than in the browser. Here’s how to dump the DB:

firefox_history() (
    output="firefox-history.txt"
    db=$(mktemp)
    [ -f $db ] || cp $(find ~/.mozilla -name places.sqlite {} +) $db
    echo "Writing to $output"
    sqlite3 $db '.width 100 100' 'select datetime(last_visit_date / 1000000, "unixepoch") date, url, title from moz_places' | sed 's/  *$//' >  $output
)

The output file contains the fields date, url and title:

$ firefox_history
Writing to firefox-history.txt

$ cat firefox-history.txt
...
                     https://www.theopensourceway.org/
2019-08-13 18:48:57  https://www.wikipedia.org/                                                                            Wikipedia
2019-10-08 22:53:25  https://librivox.org/
                     https://www.openclipart.org/
                     https://www.freesound.org/
                     https://creativecommons.org/
2018-08-16 04:20:28  https://www.google.com/search?q=yum+install+git&ie=utf-8&oe=utf-8&client=firefox-b-1-ab               yum install git - Google Search
2018-08-16 04:20:33  https://www.digitalocean.com/community/tutorials/how-to-install-git-on-centos-7                       How To Install Git on CentOS 7 | DigitalOcean
2018-08-16 04:20:50  https://www.google.com/search?q=get+package+information+with+yum&ie=utf-8&oe=utf-8&client=firefox-b-  get package information with yum - Google Search
2019-03-31 19:07:16  https://serverfault.com/questions/843494/how-to-get-package-info-on-yum                               linux - How to get package info on YUM - Server Fault
2018-08-16 04:21:33  https://www.google.com/search?q=apt+display+package+info&ie=utf-8&oe=utf-8&client=firefox-b-1-ab      apt display package info - Google Search
2018-08-16 04:21:37  https://askubuntu.com/questions/341178/how-do-i-get-details-about-a-package-which-isnt-installed      apt - How do I get details about a package which isn't installed? - Ask Ubuntu
...

Cool stuff.