[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5

ulimit Command

Purpose

Sets or reports user resource limits.

Syntax

ulimit [ -H ] [ -S ] [ -a ] [ -c ] [ -d ] [  -f ] [ -m ] [ -n ] [ -s ] [ -t ] [ Limit ]

Description

The ulimit command sets or reports user process resource limits, as defined in the /etc/security/limits file. This file contains these default limits:

fsize = 2097151
core = 2097151
cpu = -1
data = 262144
rss = 65536
stack = 65536
nofiles = 2000

These values are used as default settings when a new user is added to the system. The values are set with the mkuser command when the user is added to the system, or changed with the chuser command.

Limits are categorized as either soft or hard. With the ulimit command, you can change your soft limits, up to the maximum set by the hard limits. You must have root user authority to change resource hard limits.

Many systems do not contain one or more of these limits. The limit for a specified resource is set when the Limit parameter is specified. The value of the Limit parameter can be a number in the unit specified with each resource, or the value unlimited. To set the specific ulimit to unlimited, use the word unlimited

Note: Setting the default limits in the /etc/security/limits file sets system wide limits, not just limits taken on by a user when that user is created.

The current resource limit is printed when you omit the Limit parameter. The soft limit is printed unless you specify the -H flag. When you specify more than one resource, the limit name and unit is printed before the value. If no option is given, the -f flag is assumed.

Since the ulimit command affects the current shell environment, it is provided as a shell regular built-in command. If this command is called in a separate command execution environment, it does not affect the file size limit of the caller's environment. This would be the case in the following examples:

nohup ulimit -f 10000
env ulimit 10000

Once a hard limit has been decreased by a process, it cannot be increased without root privilege, even to revert to the original limit.

For more information about user and system resource limits, refer to the getrlimit, setrlimit, or vlimit subroutine in AIX 5L Version 5.2 Technical Reference: Base Operating System and Extensions Volume 1.

Flags

-a Lists all of the current resource limits.
-c Specifies the size of core dumps, in number of 512-byte blocks.
-d Specifies the size of the data area, in number of K bytes.
-f Sets the file size limit in blocks when the Limit parameter is used, or reports the file size limit if no parameter is specified. The -f flag is the default.
-H Specifies that the hard limit for the given resource is set. If you have root user authority, you can increase the hard limit. Anyone can decrease it.
-m Specifies the size of physical memory, in number of K bytes.
-n Specifies the limit on the number of file descriptors a process may have.
-s Specifies the stack size, in number of K bytes.
-S Specifies that the soft limit for the given resource is set. A soft limit can be increased up to the value of the hard limit. If neither the -H nor -S flags are specified, the limit applies to both.
-t Specifies the number of seconds to be used by each process.

Exit Status

The following exit values are returned:

0 Successful completion.
>0 A request for a higher limit was rejected or an error occurred.

Example

To set the file size limit to 51,200 bytes, enter:

ulimit -f 100

Files

/usr/bin/ksh Contains the ulimit built-in command.

Related Information

The ksh command.

The ulimit subroutine, getrlimit, setrlimit, or vlimit subroutine in AIX 5L Version 5.2 Technical Reference: Base Operating System and Extensions Volume 1.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]