March 08, 2010 by
Bash history can be a lifesaver, but when you need it, you usually also need to know when the commands were run. To do this, put the following line in your ~/.bashrc
export HISTTIMEFORMAT="[%x %X] "
This tells bash to prepend lines to .bash_history with the timestamp (commented) so when you run history, the timestamps get pulled in alongside the commands.