tee
tee [OPTION]... [FILE]...
Copy standard input to each FILE, and also to standard output.
Options
--help,-h-
Print help
--append,-a-
append to the given FILEs, do not overwrite
--ignore-interrupts,-i-
ignore interrupt signals (ignored on non-Unix platforms)
-p-
set write error behavior (ignored on non-Unix platforms)
--output-error-
set write error behavior
If a FILE is -, it refers to a file named - .
Examples
Copy stdin to each file, and also to stdout:
echo "example" | tee {{path/to/file}}
Append to the given files, do not overwrite:
echo "example" | tee {{[-a|--append]}} {{path/to/file}}
Print stdin to the terminal, and also pipe it into another program for further processing:
echo "example" | tee {{/dev/tty}} | {{xargs printf "[%s]"}}
Create a directory called “example”, count the number of characters in “example”, and write “example” to the terminal:
echo "example" | tee >(xargs mkdir) >(wc {{[-c|--bytes]}})
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.