Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Created May 25, 2026 20:43
Show Gist options
  • Select an option

  • Save copyleftdev/69e9e9e334b95d3c6d28264df92dc522 to your computer and use it in GitHub Desktop.

Select an option

Save copyleftdev/69e9e9e334b95d3c6d28264df92dc522 to your computer and use it in GitHub Desktop.
ts — prepend a timestamp to every line of stdin
# 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