I spent years wondering why there aren’t timestamps in the bash history file, and why there’s no obvious way to add them as they would be so fundamentally useful.

Turns out there is a nice easy way to do it after all:

Set HISTTIMEFORMAT to some suitable string in your .bashrc, ie "%F %T", this puts a unix timestamp in the history file, and displays your easily readable format via the history command.

As usual, if you think something is worth doing then the chances are, someone’s already done it and you really should just go and look!

More bash stuff in the wiki

Share This: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • Technorati
  • Facebook
  • TwitThis
  • Mixx
  • Google
  • Sphinn
  • Reddit