[KLUG Members] Bash Hitory Timestamps

Bruce Smith bruce at armintl.com
Wed Oct 26 10:39:15 EDT 2005


On Wed, 2005-10-26 at 10:05 -0400, Ron Sweeney wrote:
> is there a way to tweak the format in the .bash_history to include a
> timestamp ???

Yes.  If you set the environment variable "HISTTIMEFORMAT" to a value
which describes how to display the date/time with the "history" command,
it will put timestamps in the history file.

i.e.  Add something like this to your bashrc/profile/startup-script:

  export HISTTIMEFORMAT="%F %T "

See the man pages for bash(1) and strftime(3) for more info.

 - BS




More information about the Members mailing list