How does the Linux system redirect data streams?

  

The so-called data stream is a series of data read in a certain order, so the direction of the data stream is the order in which the data stream is read. The Linux system redirects the data stream by importing the result of the data output to other In the file. So how does the Linux system redirect the data stream?

Data Stream Redirection

The following is a brief review of the two redirect operations that are often used in the past:

$ echo ‘hello shiyanlou’ 》 redirect

$ echo ‘www.shiyanlou.com’ 》 redirect

$ cat redirect

Of course, there is no such thing as "and "The operation is no problem, as you understand The same, the difference is that the direction of the redirection is inconsistent, "representation is from left to right, "right to left.

1. Simple Redirection

Before you learn more about Linux redirection, you need to know some basic things. As mentioned earlier, Linux provides three special devices by default. The display and output for the terminal are stdin (standard input, corresponding to your input at the terminal), stdout (standard output, corresponding to the output of the terminal), stderr (standard error output, corresponding to the output of the terminal).

File Descriptors

Device Files

Description

0

/dev/stdin

Standard Input< Br>

1

/dev/stdout

Standard Output

2

/dev/stderr

Standard Error One page 12345 next page total 5 pages

Copyright © Windows knowledge All Rights Reserved