[PLUG] bash history tip of the day

Sandy Herring sandy at herring.org
Thu Apr 7 23:29:42 UTC 2005


On Thu, 07 Apr 2005, Keith Nasman wrote: 
> 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.

Nice tip. However, you need to be at bash 3.0 or better to have this
feature.

Sandy
-- 
Sandy Herring, RHCE                        o              sandy at herring.org
Peck of Pickled Pisces               __  o               http://herring.org/
*nix || Web authoring questions?  |\/ o\  o  http://herring.org/finger.html
->http://herring.org/techie.html  |/\__/     http://herring.org/pub-key.asc



More information about the PLUG mailing list