vim: ft=help:tw=78:ts=8:nolist:norl:nonu:noml:

Note: that the order of redirections is significant. e.g.:

`ls > dirlist 2>&1`
directs both standard output and standard error to the file dirlist

`ls 2>&1 > dirlist`
directs only standard output to file dirlist, because standard error was
duplicated from standard output before standard output was redirected to dirlist

- `>`           equal to `1>`
- `1>&2`        redirect stdout to stderr
- `2>&1`        redirect stderr to stdout
- `>& file`     redirect stdout/stderr to file

| `cmd 2>&1` | both output and errors to file                   |
| `cmd 2>`   | redirects error output.                          |
| `cmd 1>>`  | redirect and append stdout to file.              |
| `cmd &>`   | redirect both stdout and stderr to file.         |
| `cmd 1>&2` | standard output to standard error.               |
| `cmd >&`   | redirect both stdout and stderr to file.         |
| `cmd >>&`  | append both stdout and stderr to file.           |

| `cmd >file 2>&1`   | redirects stderr to stdout then to file. |
| `cmd1 | cmd2`      | pipe stdout to cmd2                      |
| `cmd1 |& cmd2`     | pipe stdout and stderr to cmd2           |
| `cmd1 2>&1 | cmd2` | pipe stdout and stderr to cmd2           |

| `cmd > file`              | send STDOUT to file . $                            |
| `cmd 1> file`             | send STDERR to file                                |
| `cmd 2> file`             | send both STDOUT and STDERR to file . $            |
| `cmd > file 2>&1`         | send both STDOUT and STDERR to file .              |
| `cmd > file 2> file`      | send both STDOUT and STDERR to file .              |
| `cmd < file`              | receive STDIN from file                            |
| `cmd >> file`             | append STDOUT to file                              |
| `cmd 1>> file`            | append STDOUT to file                              |
| `cmd 2>> file`            | append STDERR to file                              |
| `cmd >> file 2>&1`        | append both STDOUT and STDERR to file .            |
| `cmd1 | cmd2`             | pipe STDOUT from cmd1 to cmd2 .                    |
| `cmd1 2>&1 | cmd2`        | pipe STDOUT and STDERR from cmd1 to cmd2 .         |

`cmd1 | tee file1 | cmd2`
pipe STDOUT from cmd1 to cmd2 while simultaneously writing it to file1 using tee
