1

How to set History Display Date And Time For Each Command

I need to set the date and time for each command while using history. how to set the time and date for history command

History command Add a comment
jacob
asked Dec 19 2019
edited Dec 19 2019

Answer

1

Use the following command to set the date and time

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

Then run the following command to set the environment

source ~/.bash_profile

Now run the command

history

    1  12/12/19 17:21:34 cd
    2  12/12/19 17:21:34 add-apt-repository ppa:openshot.developers/ppa
    3  12/12/19 17:21:34 ping google.com
    4  12/12/19 17:21:34 ip a
    5  12/12/19 17:21:34 systemctl restart network
Add a comment
linuxhelp
asked Dec 19 2019
Post your Answer