It is useful to run history command with date and time along with each command. Here are instructions on how to do it on Linux/Unix.
Using environment variable $HISTTIMEFORMAT
Here we are setting HISTTIMEFORMAT on command line.
$ HISTTIMEFORMAT="%c " history ... ... 495 Fri 25 Mar 2016 08:04:32 PM UTC pwd 496 Fri 25 Mar 2016 08:04:32 PM UTC ls 501 Fri 25 Mar 2016 08:11:01 PM UTC HISTTIMEFORMAT="%c " history
As per strftime manual:
%c: The preferred date and time representation for the current locale
Setting $HISTTIMEFORMAT in .bash_profile
Add the following line to ~/.bash_profile
export HISTTIMEFORMAT="%c "
And source the .bash_profile to load it in current shell (next login it would not be needed).
$ source ~/.bash_profile
Now running the
history command will show date and time also