Set max open files on CentOS 6/7


Let's say we want to increase max open file descriptors to 65535. To do that:

Open /etc/sysctl.conf for editing and add the following line or replace one if it is already there:

fs.file-max = 65535

Open /etc/security/limits.conf for editing and put the following lines at the end of file or update values if they're already set:

* hard nofile 65535
* soft nofile 65535
* hard nproc 65535
* soft nproc 65535

Reboot your server.

Make sure that OS limits has been updated:

ulimit -n

You should see updated value which is now 65535.

Rate this post:
Share this page:

See also how to:

How to extract files from zip archive in Linux command line
How to extract files from different tar archives in Linux command line
How to pretty print XML documents on Linux
How to run your PHP or Bash script as root in the most secure way
How to install PHP FastCGI Process Manager (FPM) on CentOS 7