Display Date And Time For Each Bash Command

To display shell command history with date and time under a UNIX or Linux operating systems, set up the HISTTIMEFORMAT. This will set the timestamp information associated with each bash entry in history that is written to the history file.

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile

To see history type
history
Sample output:
683 20140903 - 07:50:57 - history |grep yum
684 20140904 - 09:42:36 - yum update
685 20140904 - 09:44:16 - uname -a
686 20140904 - 09:44:30 - reboot -e
687 20140904 - 09:45:09 - shutdown -r now
688 20140904 - 09:45:12 - exit

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.