DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

tee(C)


tee -- create a tee in a pipe

Syntax

tee [ -aiu ] [ file ... ]

Description

tee copies the standard input to the standard output and also the specified files.

By default, tee truncates existing files to zero before writing to them.

tee takes the following options:


-a
Append output to the files.

-i
Ignore the SIGINT signal.

-u
Do not buffer output.
tee understands -- to delimit the end of the options.

Exit values

tee exits with a status of 2 if any of its writes to the file argument should fail.

Examples

Record keyboard input to a program in the file input.log:

tee -u input.log | program

Some programs may allow you to use the log file as input:

program < input.log

Copy and append output from a program to the file output.log:

program | tee -a output.log

Create temporary files at each stage in a pipeline:

grep ABC foo | tee ABC.grep | sort | tee ABC.sort | more

Send tee output to the terminal screen:

grep ABC foo | tee /dev/tty | sort -u > final.file

See also

cat(C), grep(C), kill(C), sort(C)

Standards conformance

tee is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005