The contents of the screen output of the Linux command are redirected to the log file

Source: Internet
Author: User

Abstract: Syn good son source: Http://www.cnblogs.com/cssdongl reprint please indicate the source

Quick mark the details of this command, lest later use and forget

We all know that you can use echo to output content to a file, such as echo "Hello,word" >> temp.txt

So what do I do now to output the screen of Hadoop or Spark's command to a file? Very simple, the command is as follows

Hadoop jar *.jar $mrClass > Mr.log 2>&1

Note the above command *.jar and $mrclass are replaced with their own jar package name and class.

Note that the 2>&1 in the back is critical, essential, and without the content output of the Hadoop jar execution process cannot be seen in Mr.log

Explain 2>&1.

1 stands for standard output, 2 for standard error

Then the command followed by 2>&1 means that the standard error and standard output of the command execution are redirected to Mr.log.

The contents of the screen output of the Linux command are redirected to the log file

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.