LINUX-----Pipeline Flow and redirection

Source: Internet
Author: User

1. Pipeline Flow

In Linux | Symbol represents pipeline Flow

Usage: Command1 | Command2

The standard output of the first command will be the standard input for the second command

Example: Cat A.txt | grep "ABC"

2.IO Stream

stdin---Standard input stream with descriptor 0

STDOUT---Standard output stream, descriptor 1

STDERR---Standard error stream, descriptor 2

3. Redirection

Output:

N> Redirect-overlay

Example: Cat A.txt 1>stdout.txt

REDIRECT the output from Cat a.txt to Stdout.txt, not in the terminal display

If stdout.txt exists, then overwrite, not present, create

N>> Redirect--add

Example: Cat A.txt 1>>stdout.txt

REDIRECT the output from Cat a.txt to Stdout.txt, not in the terminal display

If Stdout.txt exists, it is added at the end of the file, does not exist, creates

Description: 1.N represents the descriptor for IO stream in 3, and if n is omitted, the default is the standard output stream

Input:

<

Example:./a.out <a.txt

Set the input of the A.out program to think of A.txt

Reference: http://www.ibm.com/developerworks/cn/linux/l-lpic1-v3-103-4/

LINUX-----Pipeline Flow and redirection

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.