Tuesday, December 8, 2009

Adding Date And Time To Your Bash History

Edit your /etc/bashrc and append to the bottom:


export HISTTIMEFORMAT="%h/%d - %H:%M:%S "

From next login instead of:

574 tail -f /var/log/maillog
575 mailq | tail -15
576 tail -f /var/log/maillog
577 less /var/log/maillog

you get:

1002 Apr/30 - 11:46:16 grep mailadmin /var/log/maillog
1003 Apr/30 - 14:17:40 passwd mailadmin
1004 Apr/30 - 14:18:02 smbpasswd mailadmin
1005 Apr/30 - 14:50:28 history 10

No comments:

Post a Comment