Linux input/output redirection, 0-STDIN, 1-STDOUT, 2-STDERRls-al test1 test2 test3 2> error 1> normal, ls-al test1 test2 test3 can be output simultaneously. temporary redirect gr. sh: echo 'hello'> & 2; echo 'World' run. /gr. sh 2> error.txt, the error result is output to error.txt, and world is output to the screen. 4. permanent redirection: exec 1> test.txtthe echo output below will all point to test.txt. Once redirected, the original location cannot be easily redirected. The following describes the input redirection: exec 0 <test.txt, which will be taken from test. read While read lineDoEcho $ lineDone in file to create your own permanent redirection (greater than or equal to 3) Exec 3> grself.txt Echo 'Hello world'> & 35. redirect file descriptor Exec 3> & 1 # redirect 3 to 1 Exec 1> test.txt redirect 1 to test.txt file Echo 'helloworld'> & 1 Exec 1> & 3 # redirect 1 to 3, 6. input file descriptor Exec 6 <& 0 # direct 0 to 6 Exec 0 <testfile # direct testfile to 0 Read line # Read Exec 0 from testfile <& 6 # direct 6 to 07. create a read/write file descriptor that can read and write Exec 3 <> testfileRead line <& 3 Echo $ lineEcho 'Hello world'> & 38. close file descriptor Exec 3> &-list opened file descriptors/usr/bin/lsof-a-p $-d, 29. block command output echo 'hello'>/dev/null 10. create a temporary file Mktemp testing. XXXXX (at least three X Files are randomly generated to ensure that the generated temporary files are unique). Return the temporary file name Mktemp-t test after creation. XXXXXX (the-t option will force the creation of temporary files under the system/tmp and return the full path of the temporary files, not just the file name) create temporary directory tempdir = 'mktemp-d dir. XXXXXX 'CD $ tempdirtempfile1 = 'mktemp temp. XXXXXXX 'tempfile2 = 'mktemp temp. XXXXXXX '11. record Information: tee writes the file Ls-al to the screen at the same time. | tee test.txt Ls-al | tee-a test.txt (-a option, indicating appending to the file)