LinuxCommandLibrary

ulimit

Set or display shell resource limits

TLDR

Show all limits

$ ulimit -a
copy
Show file size limit
$ ulimit -f
copy
Set open files limit
$ ulimit -n [4096]
copy
Show stack size
$ ulimit -s
copy
Set unlimited stack
$ ulimit -s unlimited
copy
Show hard limits
$ ulimit -Ha
copy

SYNOPSIS

ulimit [-a] [-f] [-n] [-s] [-H] [-S] [value]

DESCRIPTION

ulimit is a shell builtin that controls resource limits for the current shell session and any processes it spawns. It can set limits on CPU time, memory usage, open file descriptors, process count, file sizes, and other system resources.
Each resource has a soft limit (the effective limit that can be raised by the user up to the hard limit) and a hard limit (the ceiling that only root can raise). Without the -H or -S flag, ulimit shows and sets the soft limit by default.
These limits are important for preventing runaway processes from consuming all system resources and for configuring applications that need higher limits, such as database servers requiring more open file descriptors.

PARAMETERS

-a

All limits.
-f
File size.
-n
Open files.
-s
Stack size.
-H
Hard limit.
-S
Soft limit.

CAVEATS

Shell builtin. Settings not persistent. Root for hard limits.

HISTORY

ulimit is a standard Unix shell builtin for controlling resource limits, available in bash, zsh, and other shells.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community