Reads from standard input and writes to both standard output and one or more files simultaneously.
tee {append} {ignore-interrupts} {flag-p} ๐ append ๐ ignore-interrupts ๐ flag-p tee {append} {ignore-interrupts} {flag-p} Sandbox: execFile · Timeout: 60s
data.io.split data.io.duplicate filesystem.io.capture | Name | Type | Required | Default | Description | Aliases |
|---|---|---|---|---|---|
append | string | No | - | append to the given FILEs, do not overwrite | -a, --append |
ignore-interrupts | string | No | - | ignore interrupt signals | -i, --ignore-interrupts |
flag-p | string | No | - | operate in a more appropriate MODE with pipes --output-error[=MODE] set behavior on write error. See MODE below --help display this help and exit --version output version information and exit | -p |
help | boolean | No | - | --help | |
output_error | boolean | No | - | --output-error | |
version | boolean | No | - | --version |
| Type | Description | MIME | Schema | Trust |
|---|---|---|---|---|
filesystem.directory.contents | Captured output written to a file | - | - | verified |
text.plain | Passthrough stdout text | text/plain | - | verified |
Inputs
text.plain Input stream to duplicate
Outputs
filesystem.directory.contents Output captured to a file on disk
text.plain Pass-through copy of input to stdout
filesystem_write Produces
filesystem.directory.contentstext.plainConsumes
text.plainCapture command output to a log file while viewing
nmap -sS target | tee scan.log Append output to an existing file
curl https://api.example.com | tee -a results.txt Display `ls` output to the user, but also write it to the given file.
ls | tee outfile.txt As above, but append the data; previous file's data remains intact while new data is added at the end of the file.
ls | tee -a outfile.txt Pipe the standard output of a given command into `tee`, which then displays it to the user and sending the data to files `one`, `two`, and `three`.
[COMMAND] | tee one two three Workaround to output data to a file, with root privileges.
echo 3 | sudo tee /proc/sys/vm/drop_caches Pipe the current Vim buffer to a shell process, which in this case is `tee`. This is especially useful as a shortcut added to `.vimrc` or similar.
:w !sudo tee % tee reads from standard input and writes to both standard output and one or more files. It is the canonical Unix tool for simultaneously displaying and capturing command output โ the essential bridge between stdout-producing tools and file-consuming tools.
tee serves as the redirect transform in artifact pipelines:
tool producing stdout โ tee โ file on disk โ tool consuming file
For example:
nmap -sS target.com | tee scan-output.txt
tar -czf archive.tar.gz scan-output.txt
This pattern: nmap (produces network.scan.nmap.xml) โ tee (redirects to file filesystem.directory.contents) โ tar (consumes filesystem.directory.contents) is the canonical transformation pipeline for artifact type mismatches.
| Command | Effect |
|---|---|
cmd | tee file |
Capture while viewing |
cmd | tee -a file |
Append to existing log |
cmd | tee file1 file2 |
Duplicate to multiple files |
cmd | tee /dev/tty |
Write to terminal directly |