Redirection output
$ Ls-l> lsoutput.txtthis command saves the lscommand output to the lsoutput.txt file.
$ Ps> lsoutput.txt use> operator to append the output content to a file. This command attaches the output of the ps command to the end of the specified file.
If you want to redirect the standard error output, add the file descriptor number to be redirected before the> operator. Because the file descriptor number output by the standard error is 2, we use the 2> operator. This method is useful when you need to discard the error message and prevent it from being displayed on the screen.
The following command redirects the standard output and standard error output to different files: $ kill-HUP 1234> killout.txt 2> killerr.txt
If you want to redirect both sets of output to a file, you can use the> & operator to combine the two outputs. As shown in the following figure: $ kill-l 1234> killouterr.txt 2> & 1
MPs queue
Generally, the output of a process is connected to the input of another process through a pipeline.
Cmd1 | ipv2shell is responsible for standard input and standard output of two commands. The standard input of cmd1 comes from the standard output of cmd1 on the terminal keyboard and is passed to cmd2 as its standard input. The standard output of cmd2 is connected to the terminal screen.
Shell re-connects the standard input and standard output streams, allowing the data stream to be output from the keyboard input to the screen using two commands.