Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any way I can see at what time the commands were executed from the bash history ? we can see the order but is there any way I can get the time also ?

Bottom-Line : Execution time in the Bash history

share|improve this question

3 Answers 3

up vote 12 down vote accepted

Try this, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:



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



For more info see man bash or An A-Z Index of the Bash command line for Linux.

share|improve this answer
Thank you for answering , just added bash to apply the changes. –  Raja Dec 15 '13 at 12:06
Thanks for the correction :) –  Mitch Dec 15 '13 at 12:06

Open terminalCtrl+Alt+T and run,




To make the changes permanent follow the below steps,

gedit ~/.bashrc

you need to add the below line to .bashrc file and then save it,

export HISTTIMEFORMAT="%d/%m/%y %T "

run the below command to source .bashrc file,

source ~/.bashrc

After that run history command.

enter image description here


share|improve this answer
Thanks for answering , \will it be permanent change ? –  Raja Dec 15 '13 at 12:06

Yes, you can: if you set $HISTTIMEFORMAT, the .bash-history will be properly timestamped. That doesn't help with existing .bash-history content, but will help in the future.

share|improve this answer
can you expand it for more clarity ? –  Raja Dec 15 '13 at 12:06
@Raja I think it means that for the already existing history the time stamps will not be correct, am I right? –  Vesnog Jan 8 at 16:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.