There are many bash guides that include adding lines such as HISTTIMEFORMAT='%d/%m/%y %T ' or HISTTIMEFORMAT="%F %T " to ~/.bashrc or /etc/bash.bashrc.

There's always a space before the final quote. E.g. it's never HISTTIMEFORMAT='%d/%m/%y %T'.

Why is this?

1 Answer 1


If the trailing space is not included in HISTTIMEFORMAT, then you won't have a space between the timestamp and the command. Here are some examples:


This results in:

33916  2014-12-18 11:03:08: echo foo

Without the space:

33916  2014-12-18 11:04:11:echo foo
  • Thanks. I didn't think that, since I had expected there to be a space between each timestamp and command automatically.
    – EmmaV
    Dec 18, 2014 at 17:13
  • 3
    Quote from the manual: "No intervening blank is printed between the formatted time stamp and the history line." Jul 20, 2017 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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