Unix & Linux
linux open-files file-descriptors ulimit
Updated Fri, 23 Sep 2022 08:40:22 GMT

Max Open Files, clarification needed


On my machine,

ulimit -n returns 2560

Given that -n returns

The maximum number of open file descriptors.

Does it mean that system won't allow more then 2560 open files to be out there at any given time?

If not, how can i find out what is a hard limit system imposes on open files?




Solution

File descriptors are created for pretty much everything (since everything in Linux is a file), from connecting to another computer over the internet to running most applications. The resource limit is for that particular point in time. Keep in mind that even after the resource isn't being used, it can take several cycles for the shell to clean them up. To see what your hard limit is set to try doing ulimit -H -n this will show you the hard limit, when you do ulimit -n it's effectively like running ulimit -S -n which shows the soft limit.