Split the output of a program

The tee command splits the output of a program, so that it can be both displayed on the screen and saved in a file. This command is usually used when you want the output of the program to be both stored and displayed at the terminal.

For example, if we want to display the output of the ls command on the terminal and store it in a file called output.txt, we can use the following command:

linux tee command

By default, tee overwrites existing files. If you want to append data to the existing files, pass the -a option to tee.
Geek University 2022