REDIRECT Redirection
Each command has an input source and an output destination, and the default behavior is standard input and standard output. In most cases, the standard input is the keyboard, and the standard output is the screen. You can modify the inputs and outputs for individual operations, which is redirection . Redirection allows a command to be entered from a source file instead of a keyboard, or output to a place other than a display (such as a file).
Use < and > to define input and output sources. Use >> append to the end of the file.
Sort<terms>terms-alpha
This command sorts the entries in the terms file and then outputs them to the Terms-alpha file.
Bash output redirect File descriptor
| 0 |
Stdin |
| 1 |
StdOut |
| 2 |
StdErr |
2>errfile
Output error messages for program Myprog to Errfile
Piping pipe
Pipeline | is an operator that combines input and output redirects, and the output of one command is immediately entered as another command
Sort<terms>terms-alpha | Mail Fred
After performing the previous action, mail the Terms-alpha file to Fred
"Linux" redirects and pipelines