system

A file descriptor is a non-negative integer that is used to access files and I/O devices in Unix-like operating systems. It’s a low-level concept used in the operating system’s system calls for reading from or writing to files or devices.

When a file is opened, the operating system creates an entry to represent that file and store the information about that opened file. This entry is represented by an integer called a file descriptor.

File descriptors are not just limited to files. They can also represent network sockets and other I/O devices.