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 example.txt, we can use the following command:

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

Leave a Reply

Your email address will not be published. Required fields are marked *