teecommand is used to split the output of a program, doing this the output can be displayed in the shell and in the same time written in a file. This is useful, for example, if we want to capture intermediate outputs of a long program. The command is named after the T-splitter used in plumbing, because they have similar functions.
Usage:The default tee command syntax is:
tee [flags] [file]Where
[flags]are the tee flags (below you will find more info), and argument
[file]is a file or a list of files, each of which receives the output.
-aAppends the output to each file, rather than overwriting it.
-iIgnores interrupt signals.
date | tee example.txtWith this example, we can see that tee writes the date in example.txt, but shows also the output (in this case the date) in the shell. If you would prefer to have content appended instead of overwritten on the file, should use