File Descriptors
When you issue any command, three files are opened and associated with that command. In the shell, each of these files is represented by a small integer called a file descriptor. A file descriptor is a mechanism by which you can associate a number with a filename and then use that number to read and write from the file. File descriptors are often referred to as file handles.
The three files opened for each command along with their corresponding file descriptors are
Standard Input (STDIN), 0
Standard Output (STDOUT), 1
Standard Error (STDERR), 2
The integer following each of these files is its file descriptor. Usually, these files are associated with the user's terminal, but they can be redirected into other files. In the previous ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access