File descriptors are the low-level mechanism Linux uses to track every open file, socket, and pipe a process holds — understanding them explains a class of “too many open files” errors that otherwise seem mysterious.
# Check the current process's file descriptor limits ulimit -n # See what file descriptors a specific process actually has open ls -l /proc/<PID>/fd # Or with lsof, more readably lsof -p <PID> # Raise the limit for the current shell session ulimit -n 65536 # Permanent limits, per-user # edit /etc/security/limits.conf: # myuser soft nofile 65536 # myuser hard nofile 65536
Why This Matters in Practice
A busy web server or database handling many concurrent connections can genuinely exhaust the default file descriptor limit (often 1024) — each open socket counts as a file descriptor, and “too many open files” errors under load are almost always this limit being hit, not an actual bug in the application itself. Raising the limit (both soft and hard) is a standard tuning step for any server expecting significant concurrent connections.