Standard Input
The standard input is the file descriptor 0. It is the command input. The default input is the keyboard, or file or other command output.
Standard output
The standard output is the file descriptor. 1. It is the command output. The default output is the screen or file.
Standard Error
The standard error is file descriptor 2. It is the output of the command error bit rate. The default value is the screen. It can also be a file.
Redirect operator description
> Write command output to a file or device (such as a printer) instead of a command prompt window or handle.
<READ command input from a file instead of a keyboard or handle.
> Add the command output to the end of the file without deleting the existing information in the file.
> & Write the output of one handle to the input of another handle.
<& Read the input from one handle and write it into another handle output.
| Read the output from one command and write it into the input of another command. It is also called an MPS queue.
Common File redirection command shell code
- Command> filename redirects the standard output to a new file
- Command> filename redirects the standard output to a file (append)
- Command 1> fielname redirects standard output to a file
- Command> filename 2> & 1 redirects the standard output and standard error to a file.
- Command 2> filename redirects a standard error to a file
- Command 2> filename redirects the standard output to a file (append)
- Command> filename 2> & 1 redirects the standard output and standard error to a file (append)
- Command <FILENAME> filename2 uses the command as the standard input in the filename file and the filename file as the standard output.
- Command <FILENAME: The command is input using the filename file as the standard.
- Command <delimiter reads data from standard input until the division of d e l I t e r is met
- Command <& M uses the file descriptor m as the standard input
- Command> & M redirects standard output to file descriptor m