Weblogs for rossen

Posted by rossen on Mon 14 Jul 2008 at 09:27
Tags: , , ,
While re-reading the man page for bash 3.1 (in etch) I discovered that one can have timestamps in the output of "history". Just set the HISTTIMEFORMAT environment variable like so:

HISTTIMEFORMAT='%F %T '
export HISTTIMEFORMAT

...and "history" will give you output like:


536 2008-07-14 10:13:02 echo $HISTTIMEFORMAT
537 2008-07-14 10:13:50 cat /etc/profile.local
538 2008-07-14 10:14:52 history

The .bash_history will contain hash-commented timestamps as seconds since the epoch:

#1216023182
echo $HISTTIMEFORMAT
#1216023230
cat /etc/profile.local
#1216023292
history

 

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search