Name

ulimit — change resource limit then chain

Synopsis

ulimit [-H] [-S] [limits...] {next-prog}

Note

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.

Description

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:

[-a KiB]

sets RLIMIT_AS, RLIMIT_DATA, RLIMIT_MEMLOCK, and RLIMIT_STACK

[-c blocks]

sets RLIMIT_CORE

[-d KiB]

sets RLIMIT_DATA

[-e number]

sets RLIMIT_NICE (only on some operating systems)

[-f blocks]

sets RLIMIT_FSIZE

[-i n]

sets RLIMIT_SIGPENDING (only on some operating systems)

[-l KiB]

sets RLIMIT_MEMLOCK

[-m KiB]

sets RLIMIT_RSS

[-n n]

sets RLIMIT_NOFILE

[-p count]

sets RLIMIT_PIPE (only on some operating systems)

[-q count]

sets RLIMIT_MSGQUEUE (only on some operating systems)

[-s KiB]

sets RLIMIT_STACK

[-t seconds]

sets RLIMIT_CPU

[-u n]

sets RLIMIT_NPROC

[-v KiB]

sets RLIMIT_AS

[-x 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 a command with finer granularity, see softlimit(1).

Author

Jonathan de Boyne Pollard