Get and set resource limits for the current shell and child processes.
medium risk
ulimit controls resource limits (open files, processes, stack size, core dumps) for the shell and its children. Limits come in two types: soft (current limit, can be raised by user) and hard (maximum ceiling, only root can raise). Critical for high-connection services.
| Flag | Meaning |
|---|---|
-n --nofile | Max open file descriptors |
-u --nproc | Max user processes |
-s --stack | Stack size in KB |
-c --core | Max core file size |
-a --all | Print all current limits |
-S --soft | Show/set soft limits |
-H --hard | Show/set hard limits |
ulimit -aShow all current resource limits · explain & risk-check →ulimit -n 65536Increase open file limit for this session · explain & risk-check →ulimit -c unlimitedEnable core dumps for debugging · explain & risk-check →cat /proc/1234/limitsCheck limits of a running process · explain & risk-check →High-traffic services (nginx, node) need `nofile` set to 65536+ in /etc/security/limits.conf or systemd unit (LimitNOFILE=65536). Default of 1024 causes 'too many open files' at load.
Reference text is hand-written and may be incomplete — check man ulimit for your version. Test destructive commands on a non-production system first.