Tuesday, January 17, 2017

Print Date/Time with command history

Execute below command on console

export HISTTIMEFORMAT='%F %T'

or make it permanant with entry in your .bashrc file
vim ~/.bashrc

enter this line
export HISTTIMEFORMAT='%F %T'

Apply the changes with below command 
source ~/.bashrc

This trick is also useful when you are trying to check execution time of any command in history.

You can simply run it once on console & check the history. It will removed once you logout from the current session

No comments:

Post a Comment