ulimit Command Reference: Flags, Usage & CI Examples
ulimit reads and sets per-process resource limits in the shell.
ulimit controls shell resource limits like open files and process count. In CI it fixes "too many open files" errors from high-concurrency test runners and connection pools.
Common flags and usage
- -a: show all current limits
- -n [N]: max open file descriptors
- -u [N]: max user processes
- -c [N]: core dump size
- A process may raise its soft limit up to the hard limit only
Example
shell
ulimit -n # show current FD limit
ulimit -n 4096 # raise it for this shell and child processes
npm testIn CI
When a parallel test runner or a busy connection pool hits EMFILE / "too many open files", raise ulimit -n before launching it. The new soft limit cannot exceed the hard limit (ulimit -Hn); a container may need its host or runtime to lift the hard cap.
Key takeaways
- ulimit -n raises the open-file-descriptor limit per process.
- It fixes EMFILE / "too many open files" in busy test runs.
- The soft limit cannot exceed the hard limit.
Related guides
ps Command Reference: Flags, Usage & CI ExamplesReference for ps: aux, -ef, -o custom columns, --sort, and a CI example that lists running processes to debug…
lsof Command Reference: Flags, Usage & CI ExamplesReference for lsof: -i, -P, -n, -p, -t, the port-and-file-owner use, and a CI example that finds which proces…
free Command Reference: Flags, Usage & CI ExamplesReference for free: -h, -m, -s, the available-vs-free distinction, and a CI example that checks memory headro…