Howto add time and date (timestamp) to your bash history log

Posted by HostsVault | Posted in How-To's | Posted on 13-05-2009-05-2008

1

Don’t you all hate this plain format of bash history  :

  743  ls -al
  744  cd www
  745  ls -al
  746  cd ~

You don’t know what time or date this commands were used , so here is a tip to keep better tracking for your history (note this needs bash version 3 or more check by running bash –version ) :

nano /etc/bashrc

add this line to the bottom of the file :

export HISTTIMEFORMAT="%F %T "
From now on your log will look like this :
  743 2009-04-29 12:02:39 ls -al
  744 2009-04-29 12:02:39 cd www
  745 2009-04-29 12:02:39 ls -al
  746 2009-04-29 12:02:39 cd ~
VN:F [1.9.3_1094]
Rating: 8.8/10 (4 votes cast)
VN:F [1.9.3_1094]
Rating: +1 (from 1 vote)
Howto add time and date (timestamp) to your bash history log, 8.8 out of 10 based on 4 ratings
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Furl
  • Slashdot
  • StumbleUpon
  • Technorati

Comments posted (1)

this is very good to know, it adds life to the boring history file.

VA:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VA:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Write a comment