1TEE(1P)                    POSIX Programmer's Manual                   TEE(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       tee — duplicate standard input
14

SYNOPSIS

16       tee [−ai] [file...]
17

DESCRIPTION

19       The tee utility shall copy standard input to standard output, making  a
20       copy in zero or more files. The tee utility shall not buffer output.
21
22       If  the  −a option is not specified, output files shall be written (see
23       Section 1.1.1.4, File Read, Write, and Creation.
24

OPTIONS

26       The tee utility  shall  conform  to  the  Base  Definitions  volume  of
27       POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
28
29       The following options shall be supported:
30
31       −a        Append the output to the files.
32
33       −i        Ignore the SIGINT signal.
34

OPERANDS

36       The following operands shall be supported:
37
38       file      A  pathname  of  an output file. If a file operand is '−', it
39                 shall refer to a file  named  ;  implementations  shall  not
40                 treat  it as meaning standard output.  Processing of at least
41                 13 file operands shall be supported.
42

STDIN

44       The standard input can be of any type.
45

INPUT FILES

47       None.
48

ENVIRONMENT VARIABLES

50       The following environment variables shall affect the execution of tee:
51
52       LANG      Provide a default value for  the  internationalization  vari‐
53                 ables  that are unset or null. (See the Base Definitions vol‐
54                 ume of POSIX.1‐2008, Section 8.2, Internationalization  Vari‐
55                 ables  for  the  precedence of internationalization variables
56                 used to determine the values of locale categories.)
57
58       LC_ALL    If set to a non-empty string value, override  the  values  of
59                 all the other internationalization variables.
60
61       LC_CTYPE  Determine  the  locale for the interpretation of sequences of
62                 bytes of text data as characters (for example, single-byte as
63                 opposed to multi-byte characters in arguments).
64
65       LC_MESSAGES
66                 Determine the locale that should be used to affect the format
67                 and contents  of  diagnostic  messages  written  to  standard
68                 error.
69
70       NLSPATH   Determine the location of message catalogs for the processing
71                 of LC_MESSAGES.
72

ASYNCHRONOUS EVENTS

74       Default, except that if the −i option was specified,  SIGINT  shall  be
75       ignored.
76

STDOUT

78       The standard output shall be a copy of the standard input.
79

STDERR

81       The standard error shall be used only for diagnostic messages.
82

OUTPUT FILES

84       If  any file operands are specified, the standard input shall be copied
85       to each named file.
86

EXTENDED DESCRIPTION

88       None.
89

EXIT STATUS

91       The following exit values shall be returned:
92
93        0    The standard input was successfully copied to all output files.
94
95       >0    An error occurred.
96

CONSEQUENCES OF ERRORS

98       If a write to any successfully opened file  operand  fails,  writes  to
99       other  successfully opened file operands and standard output shall con‐
100       tinue, but the exit status shall be non-zero.  Otherwise,  the  default
101       actions specified in Section 1.4, Utility Description Defaults apply.
102
103       The following sections are informative.
104

APPLICATION USAGE

106       The  tee  utility  is usually used in a pipeline, to make a copy of the
107       output of some utility.
108
109       The file operand is technically optional, but tee  is  no  more  useful
110       than cat when none is specified.
111

EXAMPLES

113       Save an unsorted intermediate form of the data in a pipeline:
114
115           ... | tee unsorted | sort > sorted
116

RATIONALE

118       The  buffering  requirement  means that tee is not allowed to use ISO C
119       standard fully buffered or line-buffered writes. It does not mean  that
120       tee has to do 1-byte reads followed by 1-byte writes.
121
122       It  should  be  noted  that  early  versions  of BSD ignore any invalid
123       options and accept a single '−' as an alternative  to  −i.   They  also
124       print a message if unable to open a file:
125
126           "tee: cannot access %s\n", <pathname>
127
128       Historical  implementations ignore write errors. This is explicitly not
129       permitted by this volume of POSIX.1‐2008.
130
131       Some historical implementations  use  O_APPEND  when  providing  append
132       mode;  others use the lseek() function to seek to the end-of-file after
133       opening the file without O_APPEND. This volume of POSIX.1‐2008 requires
134       functionality  equivalent  to using O_APPEND; see Section 1.1.1.4, File
135       Read, Write, and Creation.
136

FUTURE DIRECTIONS

138       None.
139

SEE ALSO

141       Chapter 1, Introduction, cat
142
143       The Base Definitions volume of  POSIX.1‐2008,  Chapter  8,  Environment
144       Variables, Section 12.2, Utility Syntax Guidelines
145
146       The System Interfaces volume of POSIX.1‐2008, lseek()
147
149       Portions  of  this text are reprinted and reproduced in electronic form
150       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
151       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
152       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
153       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
154       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
155       event of any discrepancy between this version and the original IEEE and
156       The Open Group Standard, the original IEEE and The Open Group  Standard
157       is  the  referee document. The original Standard can be obtained online
158       at http://www.unix.org/online.html .
159
160       Any typographical or formatting errors that appear  in  this  page  are
161       most likely to have been introduced during the conversion of the source
162       files to man page format. To report such errors,  see  https://www.ker
163       nel.org/doc/man-pages/reporting_bugs.html .
164
165
166
167IEEE/The Open Group                  2013                              TEE(1P)
Impressum