How to show the used and maximum file handles on Linux?

The /proc/sys/fs/file-nr contains three values. The first value shows the maximum number of files that were opened since the system was started (total allocated number). This second value shows the unused number of allocated file handles. So to find the actual number of used file handles, we need to subtract the second value from the first. Finally, the last value shows the maximum of handles that can be used.

Examples

awk '{printf("Used %i file descriptors (max %i)\n", $1-$2, $3)}' /proc/sys/fs/file-nr

Sample output

Used 31168 file descriptors (max 1608599)

Recently updated at Jan. 7, 2020

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

Yes!

Share with friends:
Share on Twitter