commands

tee — copy stdin to stdout and files

Copy input to stdout and named files; overwrites files by default, -a appends. Never use an input file as the tee output. Check status and destination. Example assumes a fresh text-streams lab fixture.

Formal Syntax & Structure

linux syntaxlinux
tee [OPTION]... [FILE]...

Parameters & Attributes

NameTypeDescription
-aoptionAppend
FILEoperandOutput file

Return Value

exit status and output

GNU tee copies input to stdout and named files and can report output errors; behavior on broken pipes depends on options. Verify every required destination, since partial output may exist after failure.

Working Example

Example Snippetlinux
head -n 1 events.txt | tee preview.txt
Linux Reference