Name

ulimit

Syntax

ulimit [OPTIONS] limit

Description

Provides control over the resources available to the shell and to processes started by it, on systems that allow such control.

Frequently used options

-a

Report all current limits.

-u NUMBER

The maximum number of processes available to a single user.

-x NUMBER

The maximum number of file locks.

-v NUMBER

The maximum amount of memory available to the shell, in kilobytes.

-H

Indicates that a hard limit is being specified.

-S

Indicates that a soft limit is being specified.

Example

View the current limits for a user:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 8192
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 8192
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Limits are defined on Linux as being either hard or soft limits. A hard limit is set by the superuser for a user or group of users and cannot be exceeded. A soft limit is also set by the superuser, but it may be temporarily overridden by a user if the need arises (by the user calling the ulimit command). For example, a user may have a soft limit of 100 on the maximum number of open files, with a hard limit of 1,000. If the user is running ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.