tee(1) — Commands
NAME
tee − Displays the output of a program and copies it into a file
SYNOPSIS
tee [−ai] file ...
The tee command reads standard input and writes both to standard output, and to each specified file.
FLAGS
-aAdds the output to the end of file instead of writing over it.
-iIgnores the SIGINT signal.
DESCRIPTION
The tee command is useful when you wish to view program output as it is displayed, and also want to save it in a file. The tee command can accept up to 20 file arguments. The tee command does not buffer output.
EXAMPLES
1.To view and save the output from a command at the same time, enter:
lint program.c | tee program.lint
This displays the standard output of the command lint program.c at the terminal, and at the same time saves a copy of it in the file program.lint. If program.lint already exists, it is deleted and replaced.
2.To display and append to a file, enter:
lint program.c | tee -a program.lint
This displays the standard output of lint program.c at the terminal and at the same time appends a copy of it to the end of program.lint. If the file program.lint does not exist, it is created.