So this "variable"? Is that set in .profile? How would I go about seeing
what it is? Echo?
Post by Jim CunningPost by Clement Twinehi all,
how can one make the history (in bash_history) to include time stamps?
-clem
HISTTIMEFORMAT
If this variable is set and not null, its value is used as a format
string for strftime(3) to print the time stamp associated with each
history entry displayed by the history builtin. If this variable is
set, time stamps are written to the history file so they may be preserved
across shell sessions.
'echo $HISTTIMEFORMAT' will display the current value of the environment
variable.
Command history is a bash feature, so you should set it in your ~/.bashrc:
HISTTIMEFORMAT='%F %T ' (see 'man strftime')
will result in 'history' producing something like this:
.....
348 2006-03-08 10:26:48 HISTTIMEFORMAT='%F %T '
349 2006-03-08 10:26:59 history | less
Note that the lines actually written to .bash_history do not have a directly
searchable timestamp, but instead are written as a pair of lines with the
first being an integer representing the time, e.g.,
#1141842419
history | less
You can convert the integer to a timestamp by
$ perl -e 'print scalar localtime(1141842419), "\n"'
Wed Mar 8 10:26:59 2006
Jim
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com