Skip to content

Instantly share code, notes, and snippets.

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

  • Save copyleftdev/7dd3664677e84bf1b81a03b2df2c52c0 to your computer and use it in GitHub Desktop.

Select an option

Save copyleftdev/7dd3664677e84bf1b81a03b2df2c52c0 to your computer and use it in GitHub Desktop.
tee — split stdout to terminal and file simultaneously
# tee — write to stdout AND a file at the same time
<command> | tee output.log # overwrite
<command> | tee -a output.log # append
<command> | tee file1 file2 # fan out to multiple files
# The AI workflow pattern — log + timestamps + live view in one pipeline:
agent-command 2>&1 | ts '[%H:%M:%S]' | tee run-$(date +%Y%m%d-%H%M%S).log
# Process and preserve the original simultaneously:
cat data.jsonl \
| tee data-raw-copy.jsonl \
| python3 transform.py \
| tee data-transformed.jsonl \
| wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment