Export Chrome (or Chromium) browsing history on Linux

To export Chrome (or Chromium) browsing history on Linux in a more flexible format than what Settings > History displays, could extract it from the History file, which is an SQLite database.

First need to find the History file. It's in the user-data-dir.

1. Find out the user-data-dir

$ ps auxf | egrep -o '\-\-user-data-dir=[^ ]+' | sort -u
--user-data-dir=/home/alain/.config/chromium/profile1
--user-data-dir=/tmp/tmp.4rfzttzuPo

2. Let's say I'm interested in the temp profile history, to find its History file:

$ userdata="/tmp/tmp.4rfzttzuPo"
$ history=$(find $userdata -name History)
$ echo history DB is: $history
history DB is: /tmp/tmp.4rfzttzuPo/Default/History

3. Copy the file elsewhere (else will get 'Error: database is locked')

$ cp $history /tmp/History

4. Finally get the history:

$ sqlite3 /tmp/History "
  SELECT datetime(last_visit_time/1000000-11644473600,'unixepoch','localtime'),
         url
  FROM urls 
  ORDER BY last_visit_time
  ASC
"

Result:

2014-01-28 22:51:49|http://tools.google.com/chrome/intl/en/welcome.html
2014-01-28 22:51:49|https://www.google.com/intl/en/chrome/browser/welcome.html
2014-01-28 22:51:58|http://news.google.com/
2014-01-28 22:52:21|http://news.yahoo.com/

5. Remove the temp file

$ rm /tmp/History

Or could skip the extra steps and just copy/paste browsing history from Settings > History, and end up with:

10:52 PM
Yahoo News - Latest News & Headlines
news.yahoo.com


10:51 PM
Google News
news.google.com


10:51 PM
Getting Started
www.google.com

1 Comment

Leave a comment

NOTE: Enclose quotes in <blockquote></blockquote>. Enclose code in <pre lang="LANG"></pre> (where LANG is one of these).