What is linux standard error?

青灯夜游
Release: 2020-05-11 18:29:37
Original
5579 people have browsed it

Output includes two types: one is the running result of the program (standard output), and the other is status and error information (standard error). The following article will introduce it to you. Friends in need can refer to it. I hope it will be helpful to everyone.

What is linux standard error?

Standard output (standard output) and standard error (standard error) are connected to the screen by default;

Standard input (standard input) is connected by default to the keyboard;

You can use IO redirection (redirection) to change the sending location of input and output;

1. Standard output

Standard output Redirect, use the redirection operator (">") to output the program to a file, the default is to rewrite from the file header;

You can use "> test.txt" to clear the text Information;

Use ">>" to add the file to the end of the text;

2. Standard error

Standard error redirection, Use "2>" for output. Since the file stream contains three types, namely "input, output, error", corresponding to "0, 1, 2";

is ">", which is equal to "1> ;", standard output;

Handle unwanted error output, use "2> /dev/null" to hide the error message of a command.

Display output and errors at the same time. Standard error is generated after standard output, that is, use ">" first, then "2>&1", command: "xxxx > xxxx 2>&1";

You can also use "&>" to directly output standard output and error, command: "xxxx &> xxxx", provided by newer versions of bash.

As shown:

What is linux standard error?

3. Standard input:

cat command (ConcATenate), the original intention is to link File, cat xxxx[1] xxxx ... > xxxx[end];

  1. If only the first parameter is used, that is, the information is output to the screen, a short file can be output , no line breaks;

  2. If only cat is used, information is obtained from the keyboard and output to the screen;

  3. If only the last parameter is used , that is, cat >

  4. ##You can use "
  5. Recommended: "
linux tutorial

"What is linux standard error?

The above is the detailed content of What is linux standard error?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!