File descriptor

> file 2>&1
&>file
&>1

redirect both stdoutput and stderror into file called ‘file’.
The line below in the code is the shorthand of the line above.
Similarly, the third line outputs both stdout and stderr to stdout which is probably shown on screen.

redirect stderror to another file

with >, we could redirector stdoutput to another file. Adding 2> file we could redirect error output to another file.
Example:

append > file 2> file2

notice that ‘&’ at the end of the line means put the command into backend. So logging error and output is important in this case’

Pipe

pipe seems complicated in cases when inputs are files, not stdin. But keep in mind that pipes takes only stdin and stdout. For files as input and output, we could use ‘-‘.
Here ‘stdin’ and ‘stdout’ for pipes are important. If we want to use the stdout of the first command in the pipe as the parameter in the command after pipe, we need to use xargs.