Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

plimit(1)

Name

plimit - get or set the resource limits of running processes

Synopsis

plimit [-hkm] [--scale[=item1,,item2,...]] pid...
plimit {-cdfnstv [soft][,hard]}... pid...

Description

If one or more of the cdfnstv options is specified, plimit sets the soft (current) limit and/or the hard (maximum) limit of the indicated resource(s) in the processes identified by the process-ID list, pid. Otherwise plimit reports the resource limits of the processes identified by the process-ID list, pid.

The owner of a process is permitted to either get or set the resource limits of a process, unless the process has the {PRIV_PROC_SENSITIVE} flag set (see the getpflags(2) man page). The {PRIV_PROC_OWNER} privilege is required to get or set the resource limits of a process which is either owned by another uid or has the {PRIV_PROC_SENSITIVE} flag set. The {PRIV_SYS_RESOURCE} privilege is required to increase a hard limit.

Options

The following options are supported:

–h

On output, file and memory sizes are scaled to a human readable format. The –h option is equivalent to using the –scale=max,1024 option.

–k

On output, show file sizes in kilobytes (1024 bytes) rather than in 512-byte blocks.

–m

On output, show file and memory sizes in megabytes (1024*1024 bytes).

–scale[=item1,item2,...]

On output, file and memory sizes are scaled to a human readable format, for example, 14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively dividing by 1024, unless otherwise specified.

–scale specified without arguments enables default scaled output, and is equivalent to –scale=max,1024.

–scale can be specified with the following arguments.

binary

Scaling is done by repetitively dividing by a scale factor of 1024. The use of binary scaling is indicated by the addition of an 'i' modifier to the suffix (Ki, Mi, Gi, ...).

max

Values are scaled to the largest unit for which the result retains a non-zero integer part. Up to 2 decimal places of fractional output may be shown.

min

Values are scaled to the smallest unit capable of showing the full value within the allotted space of 5 columns, and displayed without the use of fractional output.

minwide

Values are scaled to the smallest unit capable of showing the full value within the allotted space of 8 columns, and displayed without the use of fractional output.

1000

Scaling is done by repetitively dividing by a scale factor of 1000.

1024

Scaling is done by repetitively dividing by a scale factor of 1024.

–?
–-help

Print usage message and immediately exit.

The remainder of the options are used to change specified resource limits. They each accept an argument of the form:

soft,hard

where soft specifies the soft (current) limit and hard specifies the hard (maximum) limit. If the hard limit is not specified, the comma may be omitted. If the soft limit is an empty string, only the hard limit is set. Each limit can have one of the following forms:

unlimited

The literal string unlimited indicates that no limit applies to the given resource.

n[.n][scale]

A plain number, with an optional fraction and scale factor. When specifying CPU time, the h or m scale factors can be applied, indicating hours or minutes respectively. When specifying file or memory sizes, the k, m, g, t, p, and e scale factors can be specified, denoting kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes, respectively.

mm:ss

Minutes and seconds (for CPU time only).

The soft limit cannot exceed the hard limit.

–c soft,hard

Set core file size limits (default unit is 512-byte blocks).

–d soft,hard

Set data segment (heap) size limits (default unit is kilobytes).

–f soft,hard

Set file size limits (default unit is 512-byte blocks).

–n soft,hard

Set file descriptor limits (no default unit).

–s soft,hard

Set stack segment size limits (default unit is kilobytes).

–t soft,hard

Set CPU time limits (default unit is seconds).

–v soft,hard

Set virtual memory size limits (default unit is kilobytes).

Operands

The following operands are supported.

pid

Process ID list. May be specified as a numeric id or /proc/pid.

Examples

Example 1 Setting a limit for a single process

The following example sets the file descriptor soft limit to 1024 and does not change the hard limit, for process id 5114:

$ plimit -n 1024 5114

Note that some programs do not check if the number of file descriptors they can use has changed while running and may continue to use to the number they had at startup.

Example 2 Setting a limit for all running processes

The following example sets the maximum core dump size (both soft and hard limits) to zero bytes for all processes running on the system:

# plimit -c 0,0 /proc/*

Exit Status

plimit returns the exit value zero on success, non-zero on failure (such as no such process, permission denied, or invalid option).

Files

/proc/pid/*

process information and control files

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os

See Also

proc(1), ulimit(1), getpflags(2), getrlimit(2), setrlimit(2), proc(5), attributes(7), privileges(7)

History

The –h and –-scale options were added in Oracle Solaris 11.4.42.

The plimit command was added in Solaris 7.