commands
ulimit — inspect shell resource limits
Bash builtin reports or sets process resource limits. -S selects soft, -H hard, -n open descriptors. Child inherits limits; do not lower hard limits in your interactive shell. Use a fresh private workspace, ordinary user and bounded child processes; no sudo.
Formal Syntax & Structure
linux syntaxlinux
ulimit -Sn; ulimit -HnParameters & Attributes
| Name | Type | Description |
|---|---|---|
| -S | option | soft |
| -H | option | hard |
| -n | option | open descriptors |
Return Value
exit status and output
Bash builtin reports or sets process resource limits. -S selects soft, -H hard, -n open descriptors. Child inherits limits; do not lower hard limits in your interactive shell.
Working Example
Example Snippetlinux
soft=$(ulimit -Sn)hard=$(ulimit -Hn)printf '%s\n' "$soft" "$hard" | awk '/^(unlimited|[0-9]+)$/ {n++} END {if(n==2) print "limits available"; else exit 1}'