[Linux] data stream redirection

Source: Internet
Author: User

Data transmission during Linux Command Execution is as follows:

1) standard input (stdin): the code is 0, use <or <;

2) standard output (stdout): the code is 1, use> or>;

3) standard error output (stderr): Code 2, Use 2> or 2>;

> Indicates writing data to a file or device in overwriting mode,> indicates writing data to a file or device in accumulative mode.

<Indicates to replace the data originally required by the keyboard with the file content, and <indicates to end the input. For example, if I want to use cat to directly output the input information to the catfile, and the end ends when the keyboard inputs eof, then:

# Cat> catfile <EOF> This is a test> OK> EOF
Tee-two-way redirection From the above we can know that the data stream is either output to a file or device, or output to the screen (that is, standard output), and the tee command can achieve the goal of simultaneous output:
Tee allows the standard output to be transferred to a file. Its usage is as follows:
Tee [-a] file-a: Accumulate ls-l/home | tee homefile | more

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.