Right now, I know how to:
- find open files limit per process:
ulimit -n
- count all opened files by all processes:
lsof | wc -l
- get maximum allowed number of open files:
cat /proc/sys/fs/file-max
My question is: Why is there a limit of open files in Linux?
Best Answer
The reason is that the operating system needs memory to manage each open file, and memory is a limited resource - especially on embedded systems.
As root user you can change the maximum of the open files count per process (via
ulimit -n
) and per system (e.g.echo 800000 > /proc/sys/fs/file-max
).