This program divulges the contents of Netscape's
history.db
file. It can be called with full URLs or with a (single) pattern. If called without arguments, it displays every entry in the history file. The
~/.netscape/history.db
file is used unless the
-database
option is given.

Each output line shows the URL and its access time. The time is converted into
localtime
representation with
-localtime
(the default),
gmtime
representation with
-gmtime
- or left in raw form with
-epochtime
, which is useful for sorting by date.

To specify a pattern to match against, give one single argument without a
://
.

To look up one or more URLs, supply them as arguments:

% ggh http://www.perl.com/index.html

To find out a link you don't quite recall, use a regular expression (a single argument without a
://
is a pattern):

% ggh perl

To find out all the people you've mailed:

% ggh mailto:

To find out the FAQ sites you've visited, use a snazzy Perl pattern with an embedded
/i
modifier:

% ggh -regexp '(?i)\bfaq\b'

If you don't want the internal date converted to localtime, use
-epoch
:

% ggh -epoch http://www.perl.com/perl/

If you prefer gmtime to localtime, use
-gmtime
:

% ggh -gmtime http://www.perl.com/perl/

To look at the whole file, give no arguments (but perhaps redirect to a pager):

% ggh | less

If you want the output sorted by date, use the
-epoch
flag:

% ggh -epoch | sort -rn | less

If you want it sorted by date into your local time zone format, use a more sophisticated pipeline:

% ggh -epoch | sort -rn | perl -pe 's/\d+/localtime $&/e' | less

The Netscape release notes claim that they're using NDBM format. This is misleading: they're actually using Berkeley DB format, which is why we require DB_File (not supplied standard with all systems Perl runs on) instead of NDBM_File (which is). The program is shown in
Example 14.8
.