Shell output redirection

Source: Internet
Author: User
Overview

  • Input/Output redirection is supported in the Linux Shell environment, expressed by the symbols "<" and "> ".
  • 0 indicates standard input.
  • 1 indicates standard output
  • 2 indicates standard error message output
0, 1, and 2 can be used to specify the standard input or output to be redirected, for example, 2>/tmp/error.txt indicates to output the error information to the/tmp/error.txt file./dev/nulllinux has a special file/dev/null, it 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. If we want to display both normal output and error information, the standard output and standard error must be redirected to/dev/null. For example, the standard output must be redirected to/dev/null.

Note that when 0, 1, and 2 are redirected, do not add spaces to the "with"> "symbol.
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.