Created
May 25, 2026 20:43
-
-
Save copyleftdev/69e9e9e334b95d3c6d28264df92dc522 to your computer and use it in GitHub Desktop.
ts — prepend a timestamp to every line of stdin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ts — timestamp every line of stdin (from moreutils) | |
| # sudo apt install moreutils | |
| command | ts # May 25 13:01:02 <line> | |
| command | ts '[%H:%M:%S]' # [13:01:02] <line> | |
| command | ts '[%Y-%m-%dT%H:%M:%S]' # [2024-05-25T13:01:02] <line> | |
| command | ts -s '%.s' # relative: seconds since last line | |
| # The full AI logging pattern — timestamp, merge stderr, save + display: | |
| agent-command 2>&1 | ts '[%H:%M:%S]' | tee run.log | |
| # Replay a log with delays to see where time was spent: | |
| while IFS= read -r line; do sleep 0.1; echo "$line"; done < agent.log \ | |
| | ts -s '%.s' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment