Display Date and Time for each Command in Bash History
In this tutorial, How to list command display date and time command previously typed in Bash History. The Bash shell provides the command history.
Display Date and Time for each Command in Bash History.
The default history command
$ history
The output terminal as below
Set time stamps in bash history
Define the environment variable name
$ HISTTIMEFORMAT="%d/%m/%y %T "The output as below
Or your add ~/.bash_profile file
$ echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile
$ cd
$ source ~/.bash_profile
The output terminal as below
To retrieve Linux bash command line history
$ history
The output terminal as below
Comments
Post a Comment