RedHat of 25 online training courses --- 4

First, knowledge:

Redirect: redirect input and output redirection points;

Redirect standard input (STDIN, file descriptor 0): Default input from the keyboard, may also be input from another file or command.
Redirect standard output (STDOUT, file descriptor 1): The default output to the screen.
Redirect the error output (STDERR, file descriptor 2): The default output to the screen.

  1. Command <file: the file as a command of standard input
  2. << command delimiter: reads from the standard input, until stopped met delimiter
  3. Command <Document 1> File 2: 1 as a command file standard input and standard output to the file 2

  4. Command> redirect standard output file to a file (original file data is empty)
  5. Command 2> file error output is redirected to a file (original file data is empty)
  6. Command >> file redirect standard output to a file (appended to the original content)
  7. 2 command >> file error output redirected to a file (appended to the original content)
  8. File command >> 2> & 1 (or command file >> &): standard error output together with the output written to the file (appended to the original content)

Output redirection operators: original output commands to the information screen, which is output to a file, sub-type cover (> Clear the original content) and the additional type (>>) thereof.

Or whether errors are denoted output file: & >> or 2> & 1
Examples: wc -l </ etc / passwd

vim editor:
RedHat of 25 online training courses --- 4

Guess you like

Origin blog.51cto.com/518004/2472958