Monday, November 19, 2012

Timestamp for BASH history

If you run to "record" a time-stamp history on your BASH command so that you can do a better tracing of what was run at certain time. It is quite easy to implement.

$ echo 'export HISTTIMEFORMAT="%h/%d - %H:%M:%S "' >> ~/.bashrc

$ source .bashrc

$ history

  ....
  ....
  997  Nov/20 - 13:46:11 vim .bashrc
  998  Nov/20 - 13:46:17 source .bashrc
  999  Nov/20 - 13:46:26 ls
 1000  Nov/20 - 13:46:36 exit
 1001  Nov/20 - 13:46:50 ls
 1002  Nov/20 - 13:46:54 ssh server-c00
 1003  Nov/20 - 13:47:15 ls
 1004  Nov/20 - 13:47:19 ls -al
 1005  Nov/20 - 13:47:27 history
 1006  Nov/20 - 13:56:58 history
 1007  Nov/20 - 13:57:02 history|more
 1008  Nov/20 - 13:58:47 history|more

No comments: