The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


tee - duplicate standard input


tee [-ai][file...]


The tee utility will copy standard input to standard output, making a copy in zero or more files. The tee utility will not buffer output.

The options determine if the specified files are overwritten or appended to.


The tee utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported:

-a (null)
Append the output to the files rather than overwriting them.
-i (null)
Ignore the SIGINT signal.


The following operands are supported:
A pathname of an output file. Processing of at least 13 file operands will be supported.


The standard input can be of any type.




The following environment variables affect the execution of tee:
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
If set to a non-empty string value, override the values of all the other internationalisation variables.
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
Determine the location of message catalogues for the processing of LC_MESSAGES .


Default, except that if the -i option was specified, SIGINT will be ignored.


The standard output will be a copy of the standard input.


Used only for diagnostic messages.


If any file operands are specified, the standard input will be copied to each named file.




The following exit values are returned:
The standard input was successfully copied to all output files.
An error occurred.


If a write to any successfully opened file operand fails, writes to other successfully opened file operands and standard output will continue, but the exit status will be non-zero. Otherwise, the default actions specified in Utility Description Defaults will apply.


The tee utility is usually used in a pipeline, to make a copy of the output of some utility.

The file operand is technically optional, but tee is no more useful than cat when none is specified.


Save an unsorted intermediate form of the data in a pipeline:

. . . | tee unsorted | sort > sorted 





UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]