STDIN/STDOUT/STDERR

STDIN is input going to a command. This can be read from a text file, typed on the keyboard, or piped from another command.

STDOUT is regular output from a command. By default, this is printed to the terminal, but it can also be redirected into a text file or piped to another command.

STDERR is error or logging output from a command. This is kept separate to keep a command’s error messages from ending up in the next command you pipe its output to.

The internal file descriptors are 0 for STDIN, 1 for STDOUT, and 2 for STDERR.
> will redirect STDOUT. 2> will redirect STDERR.
>&2 has two parts. > means “redirect STDOUT”. &2 represents the STDERR file handle associated with the current command. So >&2 means “redirect the output of STDOUT to STDERR”.
1> and > are the same.

>> means append. If you use >, it will erase whatever is in the file you point it at before writing anything to it. If you use >>, the output will just be added to the end of the file.
This means you can run > filename to delete the contents of filename.

< in the other direction means “read this file and use it as input for the following command”
So cat logfile.txt | grep “password” and grep “password” < logfile.txt do the same thing.
0< and < are the same. Remember that 0 is the identifier for STDIN.