Linux tee Command
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:
- -a or --append Append to an existing file instead of overwriting it.
- -i or --ignore-interrupts Ignore interrupt signals.
- --help Online help.
- --version Display version information.
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