"Too Many Files Open" error in Linux

Concurrent processing of multiple process flows may require opening files more than the default limit on a Linux System. The following instructions are for CentOS Linux distribution to verify and increase the limit of Open Files.

- To find the System wide file open limit
#cat /proc/sys/fs/file-max

- To increase the system wide file open limit
#vi /etc/sysctl.conf

- Append the following line at the end of the file to increase the count to 300000
fs.file-max = 300000

- Save and Exit

- Apply the changes immediately
#sysctl -p

- Verify the changes
#cat /proc/sys/fs/file-max

- User Level Limits

- To see the file open limit for the current user
# ulimit -Hn
# ulimit -Sn

- To increase the file open limit for the root user
# vi /etc/security/limits.conf

- Append the following lines at the end of the file to Set root user soft and hard limits to 6000 and 10000 respectively as follows:
root soft nofile 6000
root hard nofile 10000

- Save and close the file

- Log out and log back in

- Verify the changes
#ulimit -Hn
#ulimit -Sn

Have more questions? Submit a request


Article is closed for comments.