Learning Academy

The Cure of Ignorance is to Question. MUHAMMAD (PBUH)

Commands

How to display date and time in Linux Bash HISTORY command?

If the HISTTIMEFORMAT is set, the time stamp information associated with each history entry is written to the history file, marked with the history comment character. Defining the environment variable as follows:

1
 

1
$ HISTTIMEFORMAT="%d/%m/%y %T "

OR

1
 

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

Where,
%d – Day
%m – Month
%y – Year
%T – Time

Muhammad Shaukat

Content Developer at LearnAcad.com

Leave a Reply

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

Pin It on Pinterest