Raise the Open Files Limit with ulimit -n
ulimit -n shows or changes the file-descriptor limit of the current shell, fixing 'Too many open files' errors for servers started from that shell.
Run `ulimit -n` to see the current soft limit and `ulimit -n 4096` to raise it for the current shell session (capped by the hard limit from `ulimit -Hn`).
01Command
Command
$ ulimit -n 409602What it does
RLIMIT_NOFILE is one greater than the highest usable file descriptor, and each socket, pipe, or open file consumes one, so long-running daemons exhaust it with the default 1024 soft limit. ulimit -n sets the soft limit only, and it cannot exceed the hard limit (raise soft and hard together with `ulimit -n 4096 -Hn` if permitted). Per-shell changes do not affect already-running services — for systemd services set LimitNOFILE= in the unit, and for logins use /etc/security/limits.conf.
03Risk
04Undo
Undo
$ ulimit -n 102405Sources
- getrlimit(2)/setrlimit(2) - get/set resource limitsEvidence: RLIMIT_NOFILE specifies a value one greater than the maximum file descriptor number that can be opened by this process; limits have a soft value (enforced) and a hard value (ceiling for the soft).
Last verified: 2026-09-17 · Category: System & Settings