Duplicate standard input (POSIX)
tee [-ai] [file... ]
QNX Neutrino, Microsoft Windows
The tee utility copies standard input to standard output, making a copy in zero or more files. It doesn't buffer its output. You usually use tee in a pipeline, in order to make a copy of the output of a utility.
If -a is specified, the named file is opened for appending and data from tee is added to the file's existing data. If -a isn't specified, the file is opened for writing and the original data in the file is lost.
While it normally takes the default action for all signals, tee ignores SIGINT if -i is specified.
Look for some spots in a collection of C programs where a variable count looks like it's being assigned a value, and tee the output both to standard output (where you can see it immediately) and a file output where you can look at it later (note the grep example here isn't sufficient for an exhaustive examination of where count might be assigned a value):
grep 'count *[^+-/\*]\{,1\}= *[!-([:alnum:]]' | tee output
An output file is created for each file operand.
If a write to any successfully opened file fails, writes to standard output and other successfully opened files continue. The exit status, however, is nonzero.