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 very useful. When we do not need to display all information about the program, we 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 :-)
+:
$ Make> & filename. log &
This means to redirect both standard output and error output. make> out only redirects standard output.
> Log indicates to redirect the standard output to the file log.
> & Log indicates that both the standard output and error output are directed to the file log, which is equivalent to> log 2> & 1