Add date and time to bash history

The .bash_history file has no date or time information in it. Sometimes it would be very nice to know when some command got executed.

What i did is add the following 2 lines in /etc/profile:

HISTTIMEFORMAT='%F %T '
export HISTTIMEFORMAT

Now logout, and log back in. Execute a command and check ‘history’:

mark@localhost:~$ history

1 2011-11-04 16:22:31 su
2 2011-11-04 16:22:33 ps fax
3 2011-11-04 16:22:35 history

2 thoughts on “Add date and time to bash history

Leave a Reply

Your email address will not be published.

*