system enabled verified low v1.0.0

tee

Reads from standard input and writes to both standard output and one or more files simultaneously.

📋 Live Preview
tee {append} {ignore-interrupts} {flag-p}
๐Ÿ“Ž append ๐Ÿ“Ž ignore-interrupts ๐Ÿ“Ž flag-p
tee {append} {ignore-interrupts} {flag-p}

Sandbox: execFile · Timeout: 60s

Capabilities

data.io.split
data.io.duplicate
filesystem.io.capture

Parameters

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

Artifacts

TypeDescriptionMIMESchemaTrust
filesystem.directory.contentsCaptured output written to a file--verified
text.plainPassthrough stdout texttext/plain-verified

Contract

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

Side effects: filesystem_write

Workflow Edges

Produces

filesystem.directory.contentstext.plain

Consumes

text.plain

Examples

Capture 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 %

Documentation

tee โ€” Duplicate Stream Content

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.

Pipeline Role

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.

Common Usage

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

Related Tools

catddredirect

References