Home > Linux > Get timestamps on Bash’s History

Get timestamps on Bash’s History

One of the annoyances of Bash, is that searching through your history has no context. When did I last run that command? What commands were run at 3am, while on the lock?

The following, single line, run in the shell, will provide date and time stamping for your Bash History the next time you login, or run bash.

echo 'export HISTTIMEFORMAT="%h/%d - %H:%M:%S "' >> ~/.bashrc

TOP