Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the meaning of 1 less than / dev/null 2 greater than & 1 in shell

Shulou Source: shulou.com Published: 2022-06-03 05:54:44 11月12日 Update

This article mainly introduces what is the meaning of 1 less than / dev/null 2 greater than & 1 in shell. It is very detailed and has a certain reference value. Interested friends must read it!

You may often see it in shell: > / dev/null 2 > & 1

The result of the command can be defined in the form of% >

/ dev/null stands for empty device file

> indicates where to redirect, for example: echo "123" > / home/123.txt

1 represents stdout standard output, and the system default value is 1, so "> / dev/null" equals "1 > / dev/null"

2 indicates stderr standard error

& indicates the equivalent meaning, 2 > & 1, indicating that the output redirection of 2 is equivalent to 1

Then the sentence in the title of this article:

1 > / dev/null first means that standard output is redirected to an empty device file, that is, no information is output to the terminal, to put it bluntly, no information is displayed.

2 > & 1 then, the standard error output redirection is equivalent to the standard output, because the standard output has been redirected to the empty device file, so the standard error output is also redirected to the empty device file.

The above is all the content of the article "what is the meaning of 1 less than / dev/null 2 greater than & 1 in shell". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Output standard file vacancy error meaning representative information content article to put it bluntly that is value interest can be passed command boy partner that is form Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS MariaDB Docker Apple