Hacker News new | ask | show | jobs
by yen223 2307 days ago
I've found a lot of use from cmd-shift-e, which shows timestamps for each output line in the terminal. Great for figuring out how long a process ran for.
4 comments

I've also used this for building outage timelines after the fact by noting the timestamps for my first time to touch and the timestamp of the repair.
Is there a way to make the timestamps permanent? Kinda sucks that they disappear when you close iTerm.
Would having them print directly in the shell prompt work? For bash, I combine PS0 support (in bash >=4.4) and PROMPT_COMMAND to do this.

My prompt command: https://github.com/paxswill/dotfiles/blob/c4c6d50123fc2535e2...

And PS0: https://github.com/paxswill/dotfiles/blob/c4c6d50123fc2535e2...

Basically the prompt command writes the current time stamp on the right edge of the window whenever the prompt is printed. Then PS0 overwrites that time stamp right before a command is executed.

If you want the time stamp on the left you can skip the prompt command and tput usage by using the \t escape code in PS1, but PS0 will need to be modified for the new location while still using tput.

Not natively:

https://gitlab.com/gnachman/iterm2/issues/4492

However, you could probably hack together a fix pretty easily with this:

https://github.com/BlueM/cliclick

Make it press cmd-shift-e as a Profile command.

didn't know this, amazing :O
I usually have my PS1 show how long the previous command took
The cool thing about iterm's timestamp is that it even applies to SSH and other shells