Add time and date (timestamp) to the history on Linux

Add time and date (timestamp) to the history on Linux

I have no idea why is this feature missing at all (?) Linux distribution, but it's time to fix that. It can be helpful in some cases.

It works with any Linux distribution. Simply run these commands, and check the history: 

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

Awesome, right?

Bonus trick: check the ID of any command on the left side in history output. Press !1000 (if the ID is 1000). It will rerun the command. It's much easier than typing the command again, or copying and pasting it.

Click here for more Linux articles.

Comments