logoalt Hacker News

Henchman21yesterday at 2:49 PM3 repliesview on HN

Genuine question for all the people putting timestamps in your prompts: do you never look at your command history and see that they’re all timestamped?


Replies

jethro_tellyesterday at 4:07 PM

I do know that though that assumes some things about os and shell.

Run a full screen term on my machine for a good chunk of my workflow and I just like to have time and battery in my term. I render it as ‘(15:35) [80} <hostname> $ ‘ and for boxes without batteries it’s just ‘(15:35) <hostname> $ ‘

Some times I’ll go back through my scroll back and look at the time when I’m trying to figure things out. Or when I run a command that generates a ton of output, I’ll note the time and run the command then later search back to the time in scroll back to start at the top of the log.

None of these are features I truly miss on a vanilla box, I can look at a clock or watch and will put a comment into the scroll back to find later.

show 1 reply
hiAndrewQuinnyesterday at 4:31 PM

Per the Bash `history` manpage:

    int history_write_timestamps
       If non-zero, timestamps are written to the history file, so they can be preserved between sessions.  The default value is 0, [...]
So this isn't true by default on many machines unless it is explicitly turned on.

I could find no command line history for Bash when I poked around. I use the fish shell, however, which does embed timestamp data by default - but I rarely think to look there when the detail might be pertinent. C'est la vie.

show 1 reply
d332yesterday at 4:40 PM

It's a different use case. If you run a slow command and check terminal later, you can see how long it took.