Name

tee [options] files — coreutils

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

Like the cat command, the tee command copies standard input to standard output unaltered. Simultaneously, however, it also copies that same standard input to one or more files. tee is most often found in the middle of pipelines, writing some intermediate data to a file while also passing it to the next command in the pipeline:

$ who | tee original_who | sort

This would print the sorted output of who on standard output, but write the original (unsorted) output of who to the file original_who.

Useful options

-a

Append instead of overwriting files.

-i

Ignore interrupt signals.

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.