Linux-screen information output to a file

Standard code name for the device name

Standard input device stdin = standard input 0  

Standard output device stdout = standard output 1

The standard error device stderr = standard error 2

 

1,echo abc 1>out.txt 或 echo abc >out.txt

  General contents of the output to a file, no output to the screen; error information output to the screen

 

2,echo abc 2>out.txt

  General Content output to the screen; error information output to a file, no output to the screen

 

3,echo abc &>out.txt

  General content, error information is output to a file, and are no longer output to the screen

 

4,echo abc 1>out1.txt 2>out2.txt

  1 regular content output to a file, an error message is output to the file 2, and are no longer output to the screen

 

There can not be left between digital code and number can be greater than the space between, with the right number is greater than the file name space

1 Use the numeric code that is regular content output by default, so the output of conventional content can not write the number 1, empty on the line. In order to facilitate memory, the proposed unified use numbers to write.

 

Reference Links: https://blog.csdn.net/LEON1741/article/details/82052018

 

Guess you like

Origin www.cnblogs.com/md5plusalt/p/12454671.html