Chapter III pipeline character, redirection and environment variables
The pipe command , "|", is used to treat the standard output of the previous command as a standard input to the latter command,
Format: "Command a| command B"
input and output redirection ,
Standard input, STDIN, file descriptor 0, default input from keyboard, 0 indicates output from other places or commands
Standard output, STDOUT, file descriptor 1, default output to screen, 1 indicates file
Error output, STDERR, file descriptor 2, default output to screen, 2 indicates file
The following is the case for output redirection:
Symbolic effect
Commands > Files redirect standard output to a file (clears the data from the original file)
Command 2> file redirects the error output to a file (clears the data from the original file)
Commands >> files redirect standard output to a file (appended to the original content)
The command 2>> file redirects the error output to a file (appended to the original content)
Command >> file 2$1 writes standard output and error output to a file (appended to the original content)
The following is the case for input redirection:
Command < file as standard input to the command
The command << delimiter reads the standard input into, until the meeting demarcation characters stops
Command < file 1> File 2 set file 1 as the standard input for the command and output the standard to file 2
The path of Linux learning