quick tip: bash 3.x supports timestamps in history entries

Posted by Tate Hansen Wed, 31 Jan 2007 02:07:00 GMT

This is worth the extra effort -- ensuring you have bash 3.x installed (3.2 is the current version). It enables you to set an environment variable to record the time and date of executed commands.

$ export HISTTIMEFORMAT="%h/%m - %H:%M:%S "

$ history | tail -2
1006 Jan/01 - 19:24:02 ls
1007 Jan/01 - 19:24:07 history | tail -2

A potential forensic treasure when needed.

Tags , , , , ,  | no comments