Results 1 to 5 of 5
how to add time to history command, according to I checked internet, they said have to use this command
Code:
echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
source ~/.bashrc
but ...
- 07-18-2011 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 33
How to set history command to show time that execute command
how to add time to history command, according to I checked internet, they said have to use this command
but on my computer still doesn't show time like they show me.Code:echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc source ~/.bashrc
Could you please help me how to add time to history command
- 07-19-2011 #2Just Joined!
- Join Date
- Jan 2011
- Location
- Fairfax, Virginia, USA
- Posts
- 94
Hi Lung,
That should be good. Here is what I did here:
Then I did typed "history" and observed this:Code:[brian@bmicek ~]$ export HISTTIMEFORMAT="%d/%m/%y %T "
The change I made only applies to this one shell, but I think your command is good. Are you sure your shell is bash? To check, run a command like this:Code:1000 18/07/11 21:00:05 export HISTTIMEFORMAT="%d/%m/%y %T " 1001 18/07/11 21:00:06 ls 1002 18/07/11 21:00:12 history
and look for /bin/bash as the last colon delimited field.Code:[brian@bmicek ~]$ grep $USER /etc/passwd
- 07-19-2011 #3Just Joined!
- Join Date
- Dec 2008
- Posts
- 33
After I run [brian@bmicek ~]$ grep $USER /etc/passwd
root
:0:0:root:/root:/bin/bash
- 07-19-2011 #4Just Joined!
- Join Date
- Jan 2011
- Location
- Fairfax, Virginia, USA
- Posts
- 94
Very interesting! Can you run this command please?
also:Code:[brian@bmicek ~]$ echo $HISTTIMEFORMAT %d/%m/%y %T
Code:[brian@bmicek ~]$ bash --version GNU bash, version 4.1.7(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
- 07-21-2011 #5Just Joined!
- Join Date
- Dec 2008
- Posts
- 33
I think The problem is The Version of Linux, I use SUSE linux 9.
After I run echo $HISTTIMEFORMAT %d/%m/%y %T
%d/%m/%y %T %d/%m/%y %T


Reply With Quote