ulimit

>Usage

The ulimit command in Unix is used to set user-level resource limits for the current shell and processes started by it. It controls the maximum resources available, such as memory usage, file size, and process counts.

>Synopsis

ulimit [ -a | -c | -f | -u | -v ... ]

>Options

-a

Displays all current limits for the user’s shell and processes.

Example:

Dots

-zsh

> ulimit -a


core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max user processes (-u) 1024
open files (-n) 256

-c

Sets the maximum size of core dump files created.

Example:

Dots

-zsh

> ulimit -c 0


Limits core dump file size to 0 blocks, effectively disabling core dumps

-f

Sets the maximum size of files the shell can create.

Example:

Dots

-zsh

> ulimit -f 1000


Limits maximum file size to 1000 blocks

-u

Sets the maximum number of processes a user can create.

Example:

Dots

-zsh

> ulimit -u 200


Limits the number of processes to 200 for the current user

-v

Sets the maximum amount of virtual memory available.

Note: This option is not supported on macOS; it is only valid on Linux.

Example:

Dots

-zsh

> ulimit -v 500000


Limits the virtual memory usage to 500,000 KB

>Quiz

Progress: Question ? out of 5

Question Title

Page written by Emily Pable