How to Increase Max Open File Limit in Linux System

Sometimes we faced issue like “Too many open files” on heavy load server. It means that our server has hit max open file limit. Now to increase open file limit on Linux,Follow below article.

Check Current Open File Limit

Use following command to check open file limit in your Linux system:

# cat /proc/sys/fs/file-max
50000

Increase Open File Limit in Linux

As per our requirement we can increase open file limit temporarily or permanently.

Temporarily Increase Open File Limit

To temporarily increase open file limit on Linux system, Use one of the following command. These setting will vanish after system reboot.

# sysctl -w fs.file-max=500000
or
# echo "500000" > /proc/sys/fs/file-max

Permanently Increase Open File Limit

Edit /etc/sysctl.conf and append following configuration to permanently increase open file limit on Linux system. These setting will remain even after system reboot.

# nano /etc/sysctl.conf
fs.file-max = 500000

After editing the configuration file execute following command to update the changes:

# sysctl -p