Timestamps in Bash

For whatever reason by default bash doesn’t add timestamps to bash.history, so here is how to make that happen.

Add the following line to /etc/bashrc

export HISTTIMEFORMAT="%d/%m/%y %T "

and now when you use the history command you get nice clean timestamps, just keep in mind this is not retroactive so it will only work going forward.  If you have just done this you might need to back out of your current session log back in or create another term window before it will start showing in the new format.

552 11/11/12 17:22:27 vi bashrc
553 11/11/12 17:22:27 man history
554 11/11/12 17:22:27 help history

1 thought on “Timestamps in Bash”

Leave a Comment

Close Bitnami banner
Bitnami