Ubuntu – Is it possible to view Google Chrome bookmarks and history from the terminal

command line

Is it possible to view Google Chrome bookmarks and history by using command line?

Best Answer

The Bookmarks is a UTF-8 plain text file in JSON format:

$ file ~/.config/google-chrome-beta/Default/Bookmarks
.config/google-chrome-beta/Default/Bookmarks: UTF-8 Unicode text
  • google-chrome-beta

    Depending on your version of Chrome

  • Default

    Depending on your profile

To view the bookmars use this command:

less ~/.config/google-chrome-beta/Default/Bookmarks

or with jq, a lightweight and flexible command-line JSON processor:

sudo apt-get install jq

and run with this command to see the whole structure:

jq '.' ~/.config/google-chrome-beta/Default/Bookmarks

or with this command to see an entry, eg. checksum:

jq '.checksum' ~/.config/google-chrome-beta/Default/Bookmarks

or all bookmarks in the bookmark bar:

jq '.roots.bookmark_bar.children' ~/.config/google-chrome-beta/Default/Bookmarks

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 all tables:

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

or to see all downloads:

sqlite> SELECT * FROM downloads WHERE 1;

Alternatively, a GUI may be used:

  • sqlitebrowser

    sudo apt-get install sqlitebrowser
    

    and start with:

    sqlitebrowser ~/.config/google-chrome-beta/Default/History
    
  • sqliteman:

    sudo apt-get install sqliteman
    

    and start with:

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