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 ...
Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.