Howto add time and date (timestamp) to your bash history log
Posted by HostsVault | Posted in How-To's | Posted on 13-05-2009-05-2008
1
Don’t you all hate this plain format of bash history :
743 ls -al 744 cd www 745 ls -al 746 cd ~
You don’t know what time or date this commands were used , so here is a tip to keep better tracking for your history (note this needs bash version 3 or more check by running bash –version ) :
nano /etc/bashrc
add this line to the bottom of the file :
export HISTTIMEFORMAT="%F %T "
From now on your log will look like this :
743 2009-04-29 12:02:39 ls -al 744 2009-04-29 12:02:39 cd www 745 2009-04-29 12:02:39 ls -al 746 2009-04-29 12:02:39 cd ~



this is very good to know, it adds life to the boring history file.