You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

tee is a command-line utility in Linux that reads from the standard input and writes to both standard output and one or more files at the same time.



Example 1: Append the text output to the file use tee with the -a (–append) option

echo "this is a new line"  | tee -a file.txt


Example 2: Append text to a file that you don't have permission to, prepend sudo before tee

echo "this is a new line" | sudo tee -a file.txt


Example 3: Append text to more than one file

echo "this is a new line"  | tee -a file1.txt file2.txt file3.txt


  • No labels