Title: tee Command
Course: CIS 121: Linux/UNIX I: Fundamentals ~ For IGNITE Review > Section: Learning Modules

Writing long pipes in Unix is fun, but sometimes you might want intermediate results. This is where tee comes in handy. The tee filter puts stdin on stdout and also into a file.

NOTE: Never use the greater than sign (>) or double greater than sign (>>) with the tee command.

[paul@RHEL4b pipes]$ tac count.txt | tee temp.txt | tac
one
two
three
four
five

[paul@RHEL4b pipes]$ cat temp.txt

five
four
three
two
one

The tee command will overwrite the file unless you use the -a option. Use the -a option when you want to append to the end of the file.

(Cobbaut, p. 124)