[PLUG] bash history tip of the day

Keith Nasman keith at ahapala.net
Thu Apr 7 22:54:51 UTC 2005


Ever look at the output of your history command and wonder when you
executed that command? If one sets the HISTTIMEFORMAT bash variable then
the history entries will have a timestamp.

The format variables can be found in the date command.

Ex:
keith at r31$ export HISTTIMEFORMAT=%d%h%y\ %H:%M

produces output like:
528  07Apr05 15:44 ls /var/www
529  07Apr05 15:45 less .bash_profile
530  07Apr05 15:53 history | tail

once you've got the HISTTIMEFORMAT you'd like, make the setting occur at
each login by putting it in ~/.bash_profile for login shells or
~/.bashrc for non-login shells.



More information about the PLUG mailing list