Add timestamp view #12793

Open
opened 2026-01-31 03:25:04 +00:00 by claunia · 8 comments
Owner

Originally created by @costincaraivan on GitHub (Mar 2, 2021).

Description of the new feature/enhancement

iTerm2 has a very nifty functionality where you press a keyboard shortcut and it creates a sort of side-column (think of the line number column or the debugging column in an IDE) where it shows timestamps for all executed commands in its scroll back buffer, plus for all "significant events".

I think, but don't quote me on that, that it also shows timestamps for important events, for example if there's a time interval longer than X and suddenly there's a message, it shows the timestamp for that, too.

It's great for retroactively investigating something, especially if you have to use a shell which doesn't implement more advanced prompt features. Or for long running operations with sudden bursts of activity.

https://iterm2.com/documentation-one-page.html

Toggle View > Show Timestamps to indicate the time each line was last modified. This is useful for telling how long operations took or when a message was printed.

Proposed technical implementation details (optional)

You press a certain keyboard shortcut/select a menu entry.

An additional column is added to the left of the terminal, containing nicely formatted timestamps, down to the second (maybe millisecond, even?) that shows timestamps for all command executions plus significant events in the entire scrollback buffer, as marked by timing of printing to the screen (pause for longer than Y seconds - maybe make this configurable? - then the next message printed is significant and its timestamp is recorded and shown).

Originally created by @costincaraivan on GitHub (Mar 2, 2021). # Description of the new feature/enhancement iTerm2 has a very nifty functionality where you press a keyboard shortcut and it creates a sort of side-column (think of the line number column or the debugging column in an IDE) where it shows timestamps for all executed commands in its scroll back buffer, plus for all "significant events". I think, but don't quote me on that, that it also shows timestamps for important events, for example if there's a time interval longer than X and suddenly there's a message, it shows the timestamp for that, too. It's great for retroactively investigating something, especially if you have to use a shell which doesn't implement more advanced prompt features. Or for long running operations with sudden bursts of activity. https://iterm2.com/documentation-one-page.html > Toggle View > Show Timestamps to indicate the time each line was last modified. This is useful for telling how long operations took or when a message was printed. # Proposed technical implementation details (optional) You press a certain keyboard shortcut/select a menu entry. An additional column is added to the left of the terminal, containing nicely formatted timestamps, down to the second (maybe millisecond, even?) that shows timestamps for all command executions plus significant events in the entire scrollback buffer, as marked by timing of printing to the screen (pause for longer than Y seconds - maybe make this configurable? - then the next message printed is significant and its timestamp is recorded and shown).
claunia added the Issue-FeatureProduct-TerminalArea-TerminalControl labels 2026-01-31 03:25:05 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Mar 2, 2021):

I'm gonna toss this on the backlog, because there's prior art for this. Thanks!

@zadjii-msft commented on GitHub (Mar 2, 2021): I'm gonna toss this on the backlog, because there's prior art for this. Thanks!
Author
Owner

@WesleyM77 commented on GitHub (Nov 11, 2021):

Would definitely love this feature!

@WesleyM77 commented on GitHub (Nov 11, 2021): Would definitely love this feature!
Author
Owner

@costincaraivan commented on GitHub (Nov 11, 2021):

@WesleyM77 The bad news for you is that this ticket has just been added to the Icebox.

Based on its name (Icebox), I don't believe this will be implemented any time soon (so maybe several years from now, at best).

@costincaraivan commented on GitHub (Nov 11, 2021): @WesleyM77 The bad news for you is that this ticket has just been added to the Icebox. Based on its name (Icebox), I don't believe this will be implemented any time soon (so maybe several years from now, at best).
Author
Owner

@zadjii-msft commented on GitHub (Nov 11, 2021):

If you're passionate about it, you're free to contribute this yourself! To be totally honest - given the single +1 this has, I'm doubting this is going to rise to our own priority lists any time soon. It's still a good feature request! I just want to be transparent about where it is in the priority queue. We're always open to being proven wrong though!

I'd suspect that most people just use the prompt in their shell to display this information. I, for example, have my prompt set up like:
image

$T in the %PROMPT% for cmd.exe will display the current time - there are other methods for other shells as well.

@zadjii-msft commented on GitHub (Nov 11, 2021): If you're passionate about it, you're free to contribute this yourself! To be totally honest - given the single +1 this has, I'm doubting this is going to rise to our own priority lists any time soon. It's still a good feature request! I just want to be transparent about where it is in the priority queue. We're always open to being proven wrong though! I'd suspect that most people just use the prompt in their shell to display this information. I, for example, have my prompt set up like: ![image](https://user-images.githubusercontent.com/18356694/141371136-bc3de020-189d-4a48-ba0d-f01a7bea6790.png) `$T` in the `%PROMPT%` for cmd.exe will display the current time - there are other methods for other shells as well.
Author
Owner

@WesleyM77 commented on GitHub (Nov 11, 2021):

@zadjii-msft woah! Didn't know I could modify the prompt like that!

@WesleyM77 commented on GitHub (Nov 11, 2021): @zadjii-msft woah! Didn't know I could modify the prompt like that!
Author
Owner

@zadjii-msft commented on GitHub (Nov 11, 2021):

@WesleyM77 You may be interested in
https://github.com/zadjii/keep/blob/master/bin/reprompt.cmd

which is a handy little .cmd script I have for updating the prompt based on branch. Useful if you're using cmd.exe, but there are many more useful alternatives on actually modern shells.

@zadjii-msft commented on GitHub (Nov 11, 2021): @WesleyM77 You may be interested in https://github.com/zadjii/keep/blob/master/bin/reprompt.cmd which is a handy little .cmd script I have for updating the prompt based on branch. Useful if you're using `cmd.exe`, but there are many more useful alternatives on actually modern shells.
Author
Owner

@costincaraivan commented on GitHub (Nov 11, 2021):

If you're passionate about it, you're free to contribute this yourself!

I'm not a C++ dev 🙂

I just want to be transparent about where it is in the priority queue. We're always open to being proven wrong though!

It's fine, you're right. I just didn't expect this request to be iced 😀

Iced

@costincaraivan commented on GitHub (Nov 11, 2021): > If you're passionate about it, you're free to contribute this yourself! I'm not a C++ dev 🙂 > I just want to be transparent about where it is in the priority queue. We're always open to being proven wrong though! It's fine, you're right. I just didn't expect this request to be iced 😀 ![Iced](https://media.giphy.com/media/KaW6fNYZf6eSk/giphy.gif)
Author
Owner

@DavidP-Vitro commented on GitHub (Oct 4, 2023):

(Yes, I know this request is 2.5 years old, but I just ended up here searching for whether this feature existed.)

One thing not addressed by the workaround of modifying the prompt is seeing timestamps for lines within outputs of commands. Sure, you get a timestamp as soon as the prompt is written after completion of the command, but that doesn't help for the middle of a long-running command.

I did however find some workarounds for this. You need to remember to invoke them when you call you command, but that's good enough for me in most cases.

In most *nix shells you can pipe a command into ts from the moreutils package. (Found as an answer on Stack Overflow.)

In PowerShell you can create a filter function that can be used the same way. (Found here.)
filter ts {"$(Get-Date -Format u): $_"}

To use either one, you then simply pipe your command into it.
ping server | ts

@DavidP-Vitro commented on GitHub (Oct 4, 2023): (Yes, I know this request is 2.5 years old, but I just ended up here searching for whether this feature existed.) One thing not addressed by the workaround of modifying the prompt is seeing timestamps for lines within outputs of commands. Sure, you get a timestamp as soon as the prompt is written after completion of the command, but that doesn't help for the middle of a long-running command. I did however find some workarounds for this. You need to remember to invoke them when you call you command, but that's good enough for me in most cases. In most *nix shells you can pipe a command into `ts` from the `moreutils` package. (Found as an [answer ](https://stackoverflow.com/questions/66119741/time-stamping-every-line-of-stdout)on Stack Overflow.) In PowerShell you can create a filter function that can be used the same way. (Found [here](https://www.itprotoday.com/powershell/easily-add-timestamp-powershell-output).) `filter ts {"$(Get-Date -Format u): $_"}` To use either one, you then simply pipe your command into it. `ping server | ts`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12793