the diary for redirection in linux
2017-04-15 19:06
423 查看
it is amazing for me to know what is redirection in Linux.
what i know is that it is control three streams , these respectfully are standardinput(0) standardoutput(1) standarderror(2).
at normal status,Bash shell receives input from keyboard, output the successful content to the terminal i am running , and if i do something wrong, it outputs the error message to the terminal as well.
what if i want redirect this workflow. redirection command helps me make that.
use greater than operator (>) we can redirect our successful result to another source.
use less than operator (<) terminal can redirect data from another source not keyboard.
use number 2 ,eg "ls -l bbbb.error 2 > errors.txt" , can redirect the error results to my defined source , here is errors.txt.
even i can put the successful and error messages to the same file, just give the error stream to successful stream, eg "ls -l haha.txt error.txt > one.txt 2>&1".
it is really crazy!!!
what i know is that it is control three streams , these respectfully are standardinput(0) standardoutput(1) standarderror(2).
at normal status,Bash shell receives input from keyboard, output the successful content to the terminal i am running , and if i do something wrong, it outputs the error message to the terminal as well.
what if i want redirect this workflow. redirection command helps me make that.
use greater than operator (>) we can redirect our successful result to another source.
use less than operator (<) terminal can redirect data from another source not keyboard.
use number 2 ,eg "ls -l bbbb.error 2 > errors.txt" , can redirect the error results to my defined source , here is errors.txt.
even i can put the successful and error messages to the same file, just give the error stream to successful stream, eg "ls -l haha.txt error.txt > one.txt 2>&1".
it is really crazy!!!
相关文章推荐
- the diary for one command application of pipe in Linux
- How to change the resolution in text mode for Linux5+
- Solaris vs. Linux: Ecosystem-based Approach and Framework for the Comparison in Large Enterprise
- Solaris vs. Linux: Ecosystem-based Approach and Framework for the Comparison in Large Enterprise
- the diary about awk scp in linux
- Error:No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
- how to implement the WaitForMultipleObjects in linux
- the diary of script in linux
- Error:No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
- the diary of how to backup one more files in linux
- The installer is unable to run in graphical mode: required operating system packages for Linux
- the diary of pipe in linux
- LINUX TOMCAT 部署 两个项目 出现Choose unique values for the 'webAppRootKey' context-param in your web.xml
- the diary of sleep jobs & fg command line in linux
- No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
- the shutdown command in linux for shutdown in time or reboot
- Solaris vs. Linux: Ecosystem-based Approach and Framework for the Comparison in Large Enterprise
- Solaris vs. Linux: Ecosystem-based Approach and Framework for the Comparison in Large Enterprise
- Linux Annoyances for Geeks : Getting the Most Flexible System in the World Just the Way You Want It
- No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi