tee

Reads data from standard input and redirects to standard output and files.

Summary

tee [OPTION]... [FILE]...

The main purpose

Parameters

FILE (optional): The file to be output, which can be one or more.

Options

Long options are equivalent to short options

-a, --append Append to file instead of overwriting.
-i, --ignore-interrupts Ignore interrupt signals (Ctrl+c interrupt operation is invalid).
-p Diagnoses errors writing to non-pipelines.
--output-error[=MODE] Sets the behavior when writing errors, see the MODE section below.
--help Display help information and exit.
--version Display version information and exit.

MODE determines the output behavior when a write error occurs. The available MODEs are as follows:

'warn' Diagnose when writing to any output reports an error.
'warn-nopipe' Diagnostics when writing to any output (not a pipe) throws an error.
'exit' Exit if an error occurs when writing to any output.
'exit-nopipe' Exit with an error when writing to any output (not a pipe).

The default MODE specified for the -p option is 'warn-nopipe'.
When '--output-error' is not included in the options, the default action is to exit immediately when an error is reported when writing to the pipe, diagnose the error message and write to the non-pipeline output.

return value

The return status is success unless illegal options or illegal parameters are given.

example

# Output process information to standard output (terminal) through a pipe and overwrite it into a file.
ps -ef |tee info_a.log info_b.log

# Output the process information to the standard output (terminal) through the pipe and append it to the file.
ps -ef |tee -a info_a.log info_b.log

Notice