Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com
huuphan.com. Powered by Blogger.

My blog about Open Source: Zimbra Mail Server,linux,bash script,centos,linux command...

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

 



post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com

This Blog is protected by DMCA.com