ulimit — change resource limit then chain
ulimit
[-H] [-S] [limits
...] {next-prog
}
Most shells have a built-in ulimit command that does not chain and that has additional interactive functionality. See the manual for each individual shell for its built-in command. This command is more commonly used with exec(1) and nosh(1). Whilst it is built in to them, it is an external command as far as shells are concerned.
ulimit is a chain-loading utility that changes its resource limits and then chain loads to next-prog
with the execvp(3) function.
next-prog
may contain its own command line options, which ulimit will ignore.
If the -H command line option is used, ulimit will set the hard resource limits. If the -S option is used as well, ulimit will set both the hard and the soft resource limits. Otherwise, ulimit will set just the soft resource limits.
The following limit options are available:
KiB
]sets RLIMIT_AS
, RLIMIT_DATA
, RLIMIT_MEMLOCK
, and RLIMIT_STACK
blocks
]sets RLIMIT_CORE
KiB
]sets RLIMIT_DATA
number
]sets RLIMIT_NICE
(only on some operating systems)
blocks
]sets RLIMIT_FSIZE
n
]sets RLIMIT_SIGPENDING
(only on some operating systems)
KiB
]sets RLIMIT_MEMLOCK
KiB
]sets RLIMIT_RSS
n
]sets RLIMIT_NOFILE
count
]sets RLIMIT_PIPE
(only on some operating systems)
count
]sets RLIMIT_MSGQUEUE
(only on some operating systems)
KiB
]sets RLIMIT_STACK
seconds
]sets RLIMIT_CPU
n
]sets RLIMIT_NPROC
KiB
]sets RLIMIT_AS
n
]sets RLIMIT_LOCKS
(only on some operating systems)
See setrlimit(2) for an explanation of the effects of these limits and the privileges that are sometimes required.
To set an "infinite" limit, use the text unlimited
for the limit value.
Similarly, the text =
or hard
will use the current value of the hard limit as the value.
(This is particularly useful when setting soft limits, as it provides a simple means of setting the soft limit to the hard limit ceiling without knowing its current value.)
Special treatment is given to the -a option because it sets multiple limits at once. An attempt to set any one soft limit greater than the matching hard limit will be silently converted into an attempt to set the soft limit equal to the hard limit.
Some limits are set in units of kilobinarybytes and blocks. For commands with finer granularity, see softlimit(1) and hardlimit(1).