Redirecting the data stream: data from one place to another.
1. Standard Input: Code 0: <, <<
2. Standard Output: Code 1:> >>
3. The standard error: Code 2: 2> 2 >>
Note: When transferring data to another file, when the file does not exist, create a file when the file exists, the contents of the file 1 will be refreshed.
Sample one: Check / file and output the information it into the ~ / File file LS / & gt; ~ / file Note: In this way there is no screen output, because the output data file in the file. Sample 2: Using the general status of the search / if there is .bashrc file home, the correct output and error output into separate files. find /home -name .bashrc &got; list_right 2> list_error This put the right information into the list_right, the wrong information into list_error, and will not export any information on the screen.
/ Dev / null Trash and Special Black Hole writing device
Applies to already know is wrong, but you want to erroneous information is not displayed and stored, and / dev / null can eat any information leading to it Sample one: throw away the erroneous data, the correct information is displayed find /home -name .bashrc &got; /dev/null
The error message and correct information in the same file First in writing: find /home -name .bashrc > list 2>&1 The second writing: find /home -name .bashrc &> list
keyboard input
Standard Input: <, <<
Sample one: Use the cat command to create a file cat > catfile testing cat file test and then [Ctrl + d] leave, this file is created and edited the Sample two: one sample changed by keyboard input as input file cat >; file1 <; file2 This put spread file1 file2 content
And that meant the end of the input <<