TEE(1POSIX)
π TEE(1POSIX) β the POSIX Programmer's Manual, but make it a group chat π
okay bestie so this is the TEE(1POSIX) page from the POSIX Programmer's Manual, and I need you to know before we even start: the Linux version of this interface may lowkey be different (go check the matching Linux man page for the deets on Linux behavior), or honestly it might not even be implemented on Linux at all. π
πΈ PROLOG πΈ
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β so consult the corresponding Linux manual page for details on Linux behavior β or the interface may not be implemented on Linux. that's it that's the prolog, moving on π«Ά
β¨ NAME β¨
tee β duplicate standard input. it's giving copy-paste but make it a whole utility π
π SYNOPSIS π
tee [-ai] [file...]
π¦ DESCRIPTION π¦
The tee utility shall copy standard input to standard output, and also make a copy in zero or more files. zero, bestie. it works with zero files. it's fine. it's just kind of pointless then, more on that later π
The tee utility shall not buffer output. no cap, no buffering, that's the whole vibe.
If the -a option is not specified, output files shall be written (see Section 1.1.1.4, File Read, Write, and Creation).
π OPTIONS π
The tee utility shall conform to the Base Definitions volume of POSIX.1β2017, Section 12.2, Utility Syntax Guidelines. slay, syntax guidelines, we love to see it β¨
The following options shall be supported:
-aβ Append the output to the files. no overwriting, just adding, we're being polite π-iβ Ignore theSIGINTsignal. as in, that Ctrl-C energy is not gonna land, bestie π
π OPERANDS π
The following operands shall be supported:
fileβ A pathname of an output file. If afileoperand is-, it shall refer to a file named-; implementations shall not treat it as meaning standard output. β οΈ literally a file whose name is a single dash, do not get it twisted. Processing of at least 13 file operands shall be supported. thirteen. iconic number. no notes. π₯
π STDIN π
The standard input can be of any type. any type. no restrictions, we're open-minded here π¦
β INPUT FILES β
None. nothing. nada. empty. we simply do not have input files, bestie π
π ENVIRONMENT VARIABLES π
The following environment variables shall affect the execution of tee:
LANGβ Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1β2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) she's the backup plan for the other locale vars, periodt.LC_ALLβ If set to a non-empty string value, override the values of all the other internationalization variables. main character energy, she overrides everyone πLC_CTYPEβ Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).LC_MESSAGESβ Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.NLSPATHβ Determine the location of message catalogs for the processing ofLC_MESSAGES.
πΈ ASYNCHRONOUS EVENTS πΈ
Default, except that if the -i option was specified, SIGINT shall be ignored. so like, normal behavior, unless you said -i, in which case that signal gets ghosted π
β¨ STDOUT β¨
The standard output shall be a copy of the standard input. that's the entire job description bestie π
π STDERR π
The standard error shall be used only for diagnostic messages. only. it's not a vibe channel, it's a diagnostics channel π€
π¦ OUTPUT FILES π¦
If any file operands are specified, the standard input shall be copied to each named file. each. and. every. one. π«Ά
π EXTENDED DESCRIPTION π
None. there's no extended description. nothing to elaborate on. we said what we said π
π EXIT STATUS π
The following exit values shall be returned:
0β The standard input was successfully copied to all output files. ate. π>0β An error occurred. π
π CONSEQUENCES OF ERRORS π
If a write to any successfully opened file operand fails, writes to other successfully opened file operands and standard output shall continue β but the exit status shall be non-zero. so she keeps going, she's resilient, but she's not pretending everything's fine, she's gonna tell you with her exit code π₯
Otherwise, the default actions specified in Section 1.4, Utility Description Defaults apply.
The following sections are informative. as in, they're here for the lore, not the law πβ¨
β APPLICATION USAGE β
The tee utility is usually used in a pipeline, to make a copy of the output of some utility. that's her moment, that's her whole thing π
The file operand is technically optional, but tee is no more useful than cat when none is specified. i'm sorry bestie someone had to say it ππ
πΈ EXAMPLES πΈ
Save an unsorted intermediate form of the data in a pipeline:
... | tee unsorted | sort > sorted
see? iconic. keeping the messy version and the sorted version. both. slay π
π¦ RATIONALE π¦
The buffering requirement means that tee is not allowed to use ISO C standard fully buffered or line-buffered writes. It does not mean that tee has to do 1-byte reads followed by 1-byte writes. read that twice bestie, because people get it wrong every single time π
It should be noted that early versions of BSD ignore any invalid options and accept a single - as an alternative to -i. They also print a message if unable to open a file:
"tee: cannot access %s\n", <pathname>
Historical implementations ignore write errors. This is explicitly not permitted by this volume of POSIX.1β2017. like, absolutely not, we do not do that here β οΈ
Some historical implementations use O_APPEND when providing append mode; others use the lseek() function to seek to the end-of-file after opening the file without O_APPEND. This volume of POSIX.1β2017 requires functionality equivalent to using O_APPEND; see Section 1.1.1.4, File Read, Write, and Creation. so like, either road, same destination, but O_APPEND-equivalent is the requirement β¨
π FUTURE DIRECTIONS π
None. the future is... nothing new here. she's done evolving, she's perfect as is π
π SEE ALSO π
- Chapter 1, Introduction,
cat - The Base Definitions volume of POSIX.1β2017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
- The System Interfaces volume of POSIX.1β2017,
lseek()
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie!! brought to you by IEEE/The Open Group, 2017 β yeah that's the source and the date, we're crediting the icons properly πβ¨
π¦ where this page comes from
- debian bookworm: manpages-posix 2017a-2 Β· Other
- debian trixie: manpages-posix 2017a-2 Β· Other
- ubuntu jammy: manpages-posix 2017a-2 Β· Other
- ubuntu noble: manpages-posix 2017a-2 Β· Other
- ubuntu resolute: manpages-posix 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms