Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
Possible duplicate of How to know the time of execution of previous commands – Paranoid Panda Jan 12 at 17:53
up vote 66 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 ; source ~/.bash_profile



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
@Raja: Your method to reload bash opens a shell into the shell ;-) and this can cause a "A process is running..." message when closing the terminal. Isn't better to reload the edited file? – Helio May 21 '15 at 9:45
For Americans its HISTTIMEFORMAT="%m/%d/%y %T " :) – Jamil Nov 6 '15 at 16:04
Note that this will only record timestamps for new history items, after HISTTIMEFORMAT is set for sessions, i.e. you can't use this retrospectively. Some answers here give the impression the history command immediately shows timestamped entries – Louis Maddox Feb 20 at 20:58

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
Hey, I'm doing this in OS X and Windows (through MINGW), and I'm adding it into .bash_profile, what's the diff between profile and rc? – Adrián Salgado Oct 1 '15 at 17:28

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 '15 at 16:50
Correction to previous post: Setting HISTTIMEFORMAT enables the display of the timestamps...even existing. My favorite is:HISTTIMEFORMAT='%F %T ' as it matters not from which country you reside...everyone knows immediately what time it is. :) – user491029 Jan 8 at 22:43

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.