Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux tee Command

Linux tee Command

Linux Command Reference Linux Command Reference

The Linux tee command reads standard input and outputs its content to a file.

The tee command reads data from standard input, outputs it to standard output, and also saves it to a file.

Syntax

tee [-ai][--help][--version][文件...]

Parameters:

Example

To use the "tee" command to save user input to both "file1" and "file2", enter the following command:



$ tee file1 file2                   #在两个文件中复制内容 

After running the above command, the user will be prompted to enter the data to save to the files, as shown below:



My Linux                        #提示用户输入数据  

My Linux                        #输出数据,进行输出反馈  

At this point, open "file1" and "file2" and check whether both contain "My Linux" to determine whether the "tee" command succeeded.

Linux Command Reference Linux Command Reference