How to set a limit on the number of files Linux can have open

limitopen files

I plan to run a Java app using nohup ... &. The limit must apply to commands like this.

Best Answer

Most systems use PAM, and have the pam_limits module set limits based on /etc/security/limits.conf. The per-user limit for open files is called nofile. You can set it for every user or for a particular user or group, and you can set a limit that the user can override (soft limit) and another that only root can override (hard limit). The documentation and the limits.conf man page have the details. For example, to raise the limit to 50000 for everyone, put this line in /etc/limits.conf (the setting takes effect when you log in):

* - nofile 50000
Related Question