In computing, tee is a command in command-line interpreters (shells) using standard streams which reads standard input and writes it to both standard output and one or more files, effectively duplicating its input. It is primarily used in conjunction with pipes and filters. The command is named after the T-splitter used in plumbing.
tee is normally used to split the output of a program so that it can be both displayed and saved in a file. The command can be used to capture intermediate output before the data is altered by another command or program. The tee command reads standard input, then writes its content to standard output. It simultaneously copies the result into the specified file(s) or variables. The syntax differs depending on the command's implementation:
Arguments:
Flags:
The command returns the following exit values (exit status):
Using process substitution lets more than one process read the standard output of the originating process. Read this example from GNU Coreutils, tee invocation.
Note: If a write to any successfully opened File operand is not successful, writes to other successfully opened File operands and standard output will continue, but the exit value will be >0.
Arguments:
Flags:
Note: When tee is used with a pipe, the output of the previous command is written to a temporary file. When that command finishes, tee reads the temporary file, displays the output, and writes it to the file(s) given as command-line argument.
Arguments:
Note: tee is implemented as a ReadOnly
command alias. The internal cmdlet name is Microsoft.PowerShell.Utility\Tee-Object
.