Skip to content
Latchkey

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 test

In 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →