Linux tee command

Linux tee command

 Linux tee command


The Linux tee command is used to route output data to multiple outputs. Tee can display output on STDOUT as well as write to file at a time.

Example

The following command will display a list of files in the current directory on the screen as well as write-in list.txt file.

ls | tee list.txt

Append Data to File

The default tee overwrites the file content. You can use -a to append data to a file.

ls | tee –a list.txt

Write data to Multiple File

You can also write the output to multiple files in a single command. The example is below

ls | tee list1.txt list2.txt
Reactions

Post a Comment

0 Comments

close