How to find out the time I executed a command
previously on UNIX Solaris?
To be more specific and more clear about what I
want to know is that I want a command the enables me to know the history
and which command I run at this history/time.
FYI I used the following command but it did not
work with me:
#export HISTTIMEFORMAT=`%F %T`
Answer:
Code:
# export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S"
or (equal)
Code:
# export HISTTIMEFORMAT="%F %T "
and results
Code:
# history
36 2011-04-13 23:55:19 history
37 2011-04-13 23:55:22 history
Code:
# export HISTTIMEFORMAT="%a %b %d %H:%M:%S %Y "
Code:
# history
36 Çar Nis 13 23:55:19 2011
history
37 Çar Nis 13 23:55:22 2011
history
Note:
BASH
Code:
# export HISTTIMEFORMAT="%F %T "
# history
1001 2011-04-18 23:21:22 history
1002 2011-04-18 23:21:30 export HISTTIMEFORMAT="%F
%T "
1003 2011-04-18 23:21:32 history
KSH
Code:
# PS1='$(date "+%F %T"|read -s)# '
# history | sed '$!N;s/^\([0-9][0-9]*[\t ]*[0-9][0-9]*-[0-9][0-9]*-[0-9][0-9]*.*\)\n[0-9][0-9]*
*\(.*\)/\1 \2/'
602 2011-04-18 23:22:01
ls
604 2011-04-18 23:22:05
ls -l
606 2011-04-18 23:22:07
history
TCSH
Code:
# set history= ( 1500 "%h %Y-%W-%D %P %R\n" )
# history
14 2011-04-18 23:23:17 ls -l
15 2011-04-18 23:23:20 history |