Sunday, 9 March 2014

LINUX - Detailed history of the commands:

Through 'history' command, We can see what are all the commands used before,

Normal 'history' command output:

#  history
    1  ls
    2  cd /
    3  cd
    4  cd /var/log/
    5  cd ..
    6  cd /
    7  cd
    8  history
Can we get more / exact details about when the commands were performed ?

Yes, we can get more information by usgin " export HISTTIMEFORMAT='%F %T ' "

After performing " export HISTTIMEFORMAT='%F %T ' ", the output goes like,

# export HISTTIMEFORMAT='%F %T '
# history
    1  2014-03-07 07:11:57 ls
    2  2014-03-07 07:12:00 cd /
    3  2014-03-07 07:12:01 cd
    4  2014-03-07 07:12:18 cd /var/log/
    5  2014-03-07 07:12:21 cd ..
    6  2014-03-07 07:12:24 cd /
    7  2014-03-07 07:12:25 cd
    8  2014-03-07 07:12:28 history
    9  2014-03-07 07:13:31 export HISTTIMEFORMAT='%F %T'
   10  2014-03-07 07:13:3 4history


Cheers !!!

No comments:

Post a Comment