prlimit(1)
Get and set process resource limits.
Synopsis
prlimit [OPTION]... [--PID pid] [LIMIT=value...]Description
Display or modify resource limits for a process. Resource limits control the maximum amount of system resources (CPU time, memory, file size, etc.) that a process can use. Without arguments, shows all limits for the current process or specified PID.
Changes apply to the specified process and its children. Use with a command to execute a process under new limits.
Common options
| Flag | What it does |
|---|---|
--pid PID | Get/set limits for the specified process ID instead of current shell |
--cpu=LIMIT | Set CPU time limit in seconds |
--nofile=LIMIT | Set maximum number of open file descriptors |
--nproc=LIMIT | Set maximum number of processes user can create |
--as=LIMIT | Set virtual memory (address space) limit in bytes |
--memlock=LIMIT | Set maximum locked memory in bytes |
--msgqueue=LIMIT | Set maximum message queue size in bytes |
-v, --verbose | Show resource limit names and values in human-readable format |
-o LIST | Specify output columns to display |
Examples
Display all resource limits for the current process
prlimitShow all limits for process with PID 1234
prlimit --pid 1234Start a new bash shell with maximum 1024 open file descriptors
prlimit --nofile=1024 bashLimit CPU time to 60 seconds for process 5678
prlimit --cpu=60 --pid 5678Run a program with 1 GB virtual memory limit
prlimit --as=1G ./memory_intensive_programDisplay all limits for PID 1234 in verbose human-readable format
prlimit -v --pid 1234Execute Python script with max 256 processes and 4096 file descriptors
prlimit --nproc=256 --nofile=4096 python script.pyRemove CPU time limit for process 1234
prlimit --pid 1234 --cpu=unlimited