How Do I Use File Descriptors in Linux?

How Do I Use File Descriptors in Linux?
Contents

What are file descriptors in Linux?

In Unix and related computer operating systems, a file descriptor (FD, less frequently fildes) is an abstract indicator (handle) used to access a file or other input/output resource, such as a pipe or network socket.

How does file descriptor work?

A file descriptor is a non – negative integer. When we open an existing or create a new file, the kernel returns a file descriptor to a process. When we want to read or write on a file, we identify the file with file descriptor that was retuned by open or create, as an argument to either read or write.

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.