To think of something simple, we know that > will transfer the data stream to a file or device, so we cannot continue to use this stream unless we go to read the file or device. What should I do if I want to save a piece of information in the process of processing this data stream? With tee We can look at this in a simple way:
Tee will distribute the data stream to the file and screen at the same time, and the output to the screen is actually stdout, allowing the next command to continue processing!
[Email protected] ~]#Tee[-A]fileoptions and Parameters:-A: Adding data to the append in a cumulative wayfileIn the Middle! [[Email protected]~]# Last|Tee Last. List |Cut-D" "-f1# This example allows us to LastThe output is stored in one copy to Last. list file; [[email protected]~]#ls-l/home |Tee~/homefile | More# This example is thelsThe data is stored in one copy to ~/Homefile, the screen also has output information! [[Email protected]~]#ls-L/|Tee-A ~/homefile | More# Be careful! TeeThe subsequent files will be overwritten, and if you add-a This option will accumulate the information.
Tee allows standard output to be transferred to a file and the same data will continue to be sent to the screen for processing! In addition to allowing us to analyze a piece of data and record it, it can also be used as an intermediate cache disk for processing a single piece of data! Tee This guy is easy to test in many selection/Fill certification exams!
reference: