"Linux" bidirectional redirect Command tee

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.