Bash - Io Redirection


Append

To append to stream, use >>

File Discriptor

The following maps the file redirect to File descriptor:

File File Descriptor
STDIN 0
STDOUT 1
STDERR 2

Join

To join two streams you can do thing 2>&1. This will join stderr into stdout.

Pipe

To pipe output from one program to another, use: |.

Redirect

  • <: Redirect stdin
  • >: Redirect stdout
  • 2>: Redirect stderr