In the Linux Shell environment, input and output redirection is supported, expressed by symbols <and>. 0, 1, and 2 indicate the standard input, standard output, and standard error information output, which can be used to specify the standard input or output to be redirected. For example, 2> a.txt outputs the error information to file a.txt.
At the same time, you can also implement redirection between the three standard input and output. For example, you can use 2> & 1 to redirect the error message to the standard output.
In Linux, there is also a special file/dev/null, which is like a bottomless pit, and all the information redirected to it will disappear without a trace. This is useful when we do not need to echoProgramYou can redirect the output to/dev/null.
To disable normal output and error information, redirect both standard output and standard errors to/dev/null. For example:
#Ls 1>/Dev/Null 2>/Dev/Null
Another way is to redirect errors to standard output and then to/dev/null, for example:
#Ls>/Dev/Null 2> &1
Note: The order here cannot be changed. Otherwise, the desired effect cannot be reached. In this case, the standard output is redirected to/dev/null and the standard error is redirected to the standard output, since the standard output has been redirected to/dev/null, the standard error will also be redirected to/dev/null, so everything will be quietly :-)