Tee command, shell
Tee command
If you want to display the running command line output on the screen and redirect it to the file, the tee command can help you complete this task.
The usage mode is as follows:
[Cmd] | tee [cmd]. log
How to Use the LINUX Command TEE Function Description: Read standard input data and output its content into a file.
Syntax: tee [-ai] [-- help] [-- version] [file…]
Note: The tee command reads data from the standard input device, outputs the data to the standard output device, and saves it as a file. We can use tee to save the data imported from the pipeline into a file, or even several files at a time.
Parameter:-a is appended to an existing file, rather than overwriting it. If the file name given the tee instruction already exists, the content of the file will be overwritten by default. After this parameter is added, the data is added at the end of the file content, and the original content is not deleted.
-I ignore the interrupt signal
-- Help Online help
-- Version: displays version information.
Example:
List the contents of the text file slayers. story and copy three copies of the file named ss-copy1, ss-copy2, and ss-copy3:
$ Cat slayers. story | tee ss-copy1 ss-copy2 ss-copy3
Shell tee command, annotation # Use find to find. /etc. /user/local. files in the/home Directory (-depth enables searching to finish searching the directory before entering the subdirectory) and back up these files to the/dev/rmt/On device using the cpio command, run the tee command to save the data to tape. log Files and output on the screen
Tee can output the input data stream to the screen and file at the same time.