Linux shell output Redirect to empty device file 1>/dev/null 2>&1__linux

Source: Internet
Author: User

Using shell commands under Linux often uses shell output redirection like this:

1>/dev/null 2>&1

At the end of the shell command, we can redirect the output through the > symbol.

1. Standard input stdin file descriptor is 0, standard output stdout file descriptor is 1, standard error stderr file descriptor is 2

2./dev/null empty equipment files, equivalent to garbage cans

3. REDIRECT Symbol:>

Explain the above shell redirection command individually:

(1) > symbols represent output redirection

(2) > Previous figures:

0 represents standard input
1 represents the STDOUT standard output, the default value is 1, so "1>/dev/null" can be abbreviated as ">/dev/null"
2 represents stderr standard error output

(3) 2>&1 stderr standard error output redirect to stdout standard output

So, 1>/dev/null 2>&1 's explanation is

Redirects the stdout standard output to the empty device file/dev/null, while redirecting the STDERR standard error output to the STDOUT standard output redirection and outputting to the empty device file/dev/null.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.