0

I turned on the time logging flags for .bash_history (HISTTIMEFORMAT='%F %T ') and as expected, when I checked history, I was able to see the time at which commands were executed, up to a point. And all the logs before that reflect the same value for time.

In the snapshot below, proceeding in the reverse direction, all commands upto and including command 500 reflect the correct times. Command 500 was executed at 12:54:50 and that value has been used for all the commands preceding it.

Timestamp observation 1

It seems by design, like maybe a threshold has been set. But can anyone confirm that or explain this behavior better?

Update -

As described in the comment below, triggered by @Terrance's reply, I tried starting a new terminal instance and the rest of the explanation is as in the comment. Here's a snapshot of this new observation -

Timestamp Observation 2

5
  • Alrightie. I'll change it to text. I'd just used the image for credibility purposes.
    – lightsong
    Feb 23, 2018 at 14:57
  • See unix.stackexchange.com/questions/87740/…
    – Terrance
    Feb 23, 2018 at 15:07
  • @Terrance Ah. But I'm positive that I set the format only today. My bash_profile and bashrc files had no record of the export statement and the history stored doesn't reflect that I'd ever done it before either.
    – lightsong
    Feb 23, 2018 at 15:18
  • My guess is that it remembers around ~12 hours of commands without the timestamp being set. When I set it on mine I noticed that the timestamps were correct for what I wrote last night and this morning, but anything before that obtained the same day timestamp as it is run. I do know that the bash_history file is written to every time you close the terminal window. See: askubuntu.com/questions/67283/…
    – Terrance
    Feb 23, 2018 at 15:27
  • @Terrance Your account seems to have taken us a little closer to the mark we want to get to. But here's a curious little observation . I commented out the HISTTIMEFORMAT in bashrc and opened up a new terminal instance. The terminal was instantiated at 21:15:46. I also edited bash_history to remove the first timestamp entry just to see if the new "placeholder" values would get modified to the next entry in place. Curiously, they all got modified to the time at which the terminal was started. I've added a snapshot of this.
    – lightsong
    Feb 23, 2018 at 15:50

0

You must log in to answer this question.

Browse other questions tagged .