47 / 102
Input/Output
In general, a command (a program):
- Gets data to process from standard input
or
stdin(default: keyboard). - Returns processed data to standard output
or
stdout(default: screen). - If program execution causes errors, error messages are sent to
standard error or
stderr(default: screen).
These three are files, and are always open. As all open files, they are assigned to a file descriptor (an integer).
| File | File descriptor |
|---|---|
/dev/stdin or /dev/fd/0 |
0 |
/dev/stdout or /dev/fd/1 |
1 |
/dev/stderr or /dev/fd/2 |
2 |