How to Check and Increase Linux Open File Limits
This guide explains how to view current soft and hard file descriptor limits on Linux, adjust them per session with ulimit, modify system-wide limits via sysctl and /etc/security/limits.conf, and make the changes persistent across reboots.
Check Linux open file limits
System-wide maximum number of file descriptors is stored in /proc/sys/fs/file-max:
# cat /proc/sys/fs/file-max
365004Per‑process limits are shown by ulimit. The hard limit ( -Hn) is the maximum value that can be set, while the soft limit ( -Sn) is the current effective limit:
# ulimit -Hn
65535
# ulimit -Sn
65535To view another user's limits, switch to that user with su and run the same commands:
# su rumenz
$ ulimit -Sn
1024
$ ulimit -Hn
1024System‑wide file descriptor limit
Server applications (e.g., MySQL/MariaDB, Apache) often require higher limits. Increase the kernel parameter fs.file-max with sysctl: # sysctl -w fs.file-max=500000 Verify the new value: # cat /proc/sys/fs/file-max Changes made with sysctl -w are temporary. To make them permanent, add the line to /etc/sysctl.conf and reload:
# vi /etc/sysctl.conf
fs.file-max=500000
# sysctl -pUser‑level open file limits
Per‑user limits are configured in /etc/security/limits.conf using the format:
<domain> <type> <item> <value>Example for user rumenz:
# Hard limit for maximum opened files
rumenz hard nofile 4096
# Soft limit for maximum opened files
rumenz soft nofile 1024After editing, the user must log out and back in for the new limits to take effect. System‑wide changes can be applied immediately with sysctl -p.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
