1. Home
  2. Linux
  3. Linux Filters
  4. Linux – tee

Linux – tee

Linux tee command

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

Example

The following command will display list of files in current directory on 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 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
Tags , ,
Was this article helpful to you? Yes 1 No
Advertisement