Skip to content

Instantly share code, notes, and snippets.

@dsanson
Created March 10, 2011 20:09
Show Gist options
  • Save dsanson/864823 to your computer and use it in GitHub Desktop.
Save dsanson/864823 to your computer and use it in GitHub Desktop.
dump chrome's history to a text file for use with quicksilver.app
#!/bin/sh
#
# export_chrome_history.sh
#
# A script to dump a list of urls from Google Chrome's History
# database on OS X. It should work on any *nix, but you'll need
# to edit the values of $input_file and $output_file.
#
#
# Author: David Sanson
# URL: https://gist.github.com/864823
# License: [MIT](http://creativecommons.org/licenses/MIT/)
#
# Dependencies: sqlite3, mktemp, perl
#
#
# Change these values if your History file is somewhere else
# or if you want to export the history to somewhere else.
input_file="$HOME/Library/Application Support/Google/Chrome/Default/History"
output_file="$HOME/Library/Application Support/Google/Chrome/Default/chrome-history.txt"
# Use this to keep the size of the history under control
n_most_recent=500
# If Chrome.app is open, the History database will be locked. So
# we'll make a temporary copy to play with.
tmp_history=`mktemp -u "/tmp/export_chrome_history.XXXXX" || exit 1`
cp "$input_file" "$tmp_history"
sqlite3 "$tmp_history" \
"select url from urls order by last_visit_time desc" \
| head -n $n_most_recent \
> $output_file
rm "$tmp_history"
@christiangenco
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment