Operations 4 min read

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.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Check and Increase Linux Open File Limits

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
365004

Per‑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
65535

To view another user's limits, switch to that user with su and run the same commands:

# su rumenz
$ ulimit -Sn
1024
$ ulimit -Hn
1024

System‑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 -p

User‑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    1024

After 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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

sysctlfile descriptorulimitlimits.conf
Liangxu Linux
Written by

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.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.