Bash redirections

Redirection makes it possible to control where the output of a command goes to, and where the input of a command comes from. Under normal circumstances, there are 3 files open, accessible by the file descriptors (FD) 0, 1 and 2, all connected to your terminal:

Name FD Description
stdin 0 standard input stream (e.g. keyboard)
stdout 1 standard output stream (e.g. monitor)
stderr 2 standard error output stream (usually also on monitor)

See some examples below:

Get hands-on with 1400+ tech skills courses.