File descriptors in Linux are integer handles that represent open files or input/output resources. They are used by the operating system to manage and access files, sockets, and other I/O resources. Each process has its own set of file descriptors.
The standard file descriptors are:
- 0: Standard Input (stdin)
- 1: Standard Output (stdout)
- 2: Standard Error (stderr)
When a file is opened, the operating system assigns it the next available file descriptor, which can be used in system calls to read from or write to the file. File descriptors are crucial for performing I/O operations in a Unix-like environment.
