is it possible to use the shell or generate a shell script to find out the browsing history from the browsers installed on the system? thank you

  • For which browser? – A.B. Jun 3 '15 at 5:31

Example for Firefox:

The history can be found in a database table in places.sqlite in SQLite format 3:

$ file ~/.mozilla/firefox/rsbxl7fx.default/places.sqlite
~/.mozilla/firefox/rsbxl7fx.default/places.sqlite: SQLite 3.x database, user version 26
  • rsbxl7fx.default

    Depending on your profile

To view the history you need to install sqlite3:

sudo apt-get install sqlite3

Start sqlite3 with

sqlite3 ~/.mozilla/firefox/rsbxl7fx.default/places.sqlite

and list eg. all tables:

sqlite> .tables
moz_anno_attributes  moz_favicons         moz_items_annos    
moz_annos            moz_historyvisits    moz_keywords       
moz_bookmarks        moz_hosts            moz_places         
moz_bookmarks_roots  moz_inputhistory

Or the history with:

sqlite> SELECT datetime(a.visit_date/1000000,'unixepoch') AS visit_date, b.url FROM moz_historyvisits AS a JOIN moz_places AS b ON a.place_id=b.id WHERE 1 ORDER BY a.visit_date ASC;

Example for Chrome:

The History is a binary file in SQLite format 3:

$ file ~/.config/google-chrome-beta/Default/History           
.config/google-chrome-beta/Default/History: SQLite 3.x database
  • google-chrome-beta

    Depending on your version of Chrome

  • Default

    Depending on your profile

To query the database, Chrome must be completely closed. Or you have to create a copy of the file and use that copy.

To view the history you need to install sqlite3:

sudo apt-get install sqlite3

Start sqlite3 with

sqlite3 ~/.config/google-chrome-beta/Default/History

and list eg. all tables:

sqlite> .tables
downloads             meta                  urls                
downloads_url_chains  segment_usage         visit_source        
keyword_search_terms  segments              visits

or to see all URLs:

sqlite> SELECT * FROM urls WHERE 1;

For all examples; alternatively, a GUI may be used:

  • sqlitebrowser

    sudo apt-get install sqlitebrowser

    and start with:

    sqlitebrowser ~/.config/google-chrome-beta/Default/History
    sqlitebrowser ~/.mozilla/firefox/rsbxl7fx.default/places.sqlite
  • sqliteman

    sudo apt-get install sqliteman

    and start with:

    sqliteman ~/.config/google-chrome-beta/Default/History
    sqliteman ~/.mozilla/firefox/rsbxl7fx.default/places.sqlite
  • @LjinKazama Were you satisfied with my answer? Then give me an upvote (∧). If I could solve your problem, then it would be nice if you'd mark my answer (✓). askubuntu.com/help/someone-answers ;) – A.B. Jun 8 '15 at 15:24
  • Just to help anyone out, when you view the database in either of these you will want to view the << moz_places >> table (version 38.8 ~ debian 8 'Jessy'). – DaveM Jun 4 '17 at 5:23

As far as firefox goes, there is .mozilla/firefox/********.default/ directory , where ****** is some number unique to your install. For me that is qgided18.default . According to https://askubuntu.com/a/412890/295286 places.sqlite file is the one that contains browsing history. You can use cat to view files, but it will be gibberish mixed with text. For actually reading it, use A.B.'s suggestion on installing sqlitebrowser


browser-history - external history of web browsers, such as netscape

The service must be added to startup scripts, and you may view the traffic recorded so far by viewing ~/.browser-history/history-log.html. However, this will not give you previous history.

  • @A.B. Its not useless, he meant the file location of the history file in the filesystem (I edited it) – chaos Jun 3 '15 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.