tee - Duplicate the output stream
Format
tee [-ai] [file ... file ...]
Description
tee clones an output stream. It copies the standard input to each output file as well as to the standard output.
Options
- -a
- Appends to (rather than overwrites) each output file.
- -i
- Ignores interrupt signals, making it suitable for use as a background process.
Examples
The following command runs the program prog and pipes the program's
standard output into tee:
prog | tee file
As a result, tee writes the output to both the standard output and the specified file.
Localization
tee uses the following localization environment variables:
- LANG
- LC_ALL
- LC_CTYPE
- LC_MESSAGES
- NLSPATH
Exit values
0
- Successful completion.
1
- Failure due to any of the following reasons:
- Out of memory when I/O buffers are allocated.
- I/O error reading or writing to a file.
- Error creating an output file.
- Error opening an output file for appending.
2
- Failure due to incorrect command-line option.
Portability
POSIX.2, X/Open Portability Guide, UNIX systems.
Related information
cat, script