How to see number of open file handles per process?

Most active processes use one or more file descriptors. These descriptors are an internal representation to the kernel of an opened file. Also opened sockets for network connections are counted as opened files. To see the correct number of opened files per process, we can leverage the /proc file system to provide this information.


find /proc/12345/fd -type l | wc -l

Count the number of file descriptors for process ID 12345

This find statement looks in the file descriptors directory belonging to a particular process ID (PID). It lists the available symlinks and gets counted using the wc command.

Sample output


Recently updated at April 27, 2023

Do you like this page? Share it with others or help us make it better


Share with friends:
Share on Twitter