System settings
Default output device: Standard output,stdout,1
Default input device: standard input,stdin,0
Standard error Output:STDERR,2
Standard input: Keyboard
Standard output and Error output: Display
1. Output redirection
>: Overwrite output
>>: Append output
If you can use set-c to prevent operational errors, the file presence cannot be overwritten function set +c can be closed
You can also use >| When you turn on set-c Force Overwrite
2. Error output Redirection
2> Coverage
2>> Append
3, that is, directional error and correct orientation
ls/varr >/tem/var3.out 2>/tem/err.out
OR
Redirect all outputs
&>
4. Input redirection
<
<<: Here documents usually << end or << EOF with end or EOF As the end prompt
Example: cat << END shows what will be written
Cat >>/tmp/myfile.txt << END Appends content redirection to be written to the /tmp/myfile.txt file
5. Command Pipeline
Enter the result of the previous command as the next command
Command 1 | command 2 | Command 3 ...
Example:echo "Hello word" | tr ' A-Z ' A-Z '
echo ' Radhat ' | passwd--stdin user1 Change Password
6,tee from the standard input read data from the standard output output data and save to a file copy
Example:echo "Hello World" | tee/tep/hello.out
This article is from the "Mr.zhu-Technology Exchange" blog, please be sure to keep this source http://bjishu.blog.51cto.com/7481301/1699662
I/O redirection in Linux