Showing History Time

When running bash command “history”, it regularly excludes the time stamps.

Session Specific TimeStamps

You can set this by running the following command:

HISTTIMEFORMAT=format
For example, the following will set your current session in the specified format:
HISTTIMEFORMAT="%y/%m/%d %T
Running history will now show you time stamps and date stamps:
# history | tail -3
 1055  17/09/16 09:46:23 echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile ; source ~/.bash_profile
 1056  17/09/16 09:46:27 HISTTIMEFORMAT="%d/%m/%y"
 1057  17/09/16 09:46:30 history | tail -3

Permanent Time Stamp

If you wish to set the time stamp permanently then you can run the following command for the user you are logged in as:

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile ; source ~/.bash_profile