dufault.info

Ramblings of a phone weenie, Linux sysadmin, and other things geeky

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.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Mixx
  • StumbleUpon
  • Technorati

1 Comment

(Required)
(Required, will not be published)

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.

« Android for the Vogue package updates to newest SDK Android v1.0 released »