4
09
2008
Enable date-stamp in your .bash_history file
While it’s easily cleared by a malicious person, this can easily extend the usefulness of your history file with the information of when you ran that command.
This works in bash v3 and up.
If you’d like to add the timestamping to all users on the machine, the file you’d want to edit is probably /etc/profile. If not, add it to your .bash_profile in your home directory (~).
Add this to the end:
HISTTIMEFORMAT=”%D %T ”
To get your current session to use the new settings:
source /etc/profile
Check it out your last 20 commands, datestamped:
history | tail -n20
I love bash, the more if the inbuilt features I learn, the more I realize how great it is.





1 Comment
Excellent tip, think I’ll use it. Thanks =)