2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
3 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\" This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH LIMIT 1 "Nov 2, 2007"
14 limit, ulimit, unlimit \- set or get limitations on the system resources
15 available to the current shell and its descendents
19 \fB/usr/bin/ulimit\fR [\fB-f\fR] [\fIblocks\fR]
25 \fBulimit\fR [\fB-\fR [HS] [a | cdfnstv]]
30 \fBulimit\fR [\fB-\fR [HS] [c | d | f | n | s | t | v]] \fIlimit\fR
36 \fBlimit\fR [\fB-h\fR] [\fIresource\fR [\fIlimit\fR]]
41 \fBunlimit\fR [\fB-h\fR] [\fIresource\fR]
47 \fBulimit\fR [\fB-HSacdfnstv\fR] [\fIlimit\fR]
53 \fBulimit\fR [\fB-HSacdfmnpstv\fR] [\fIlimit\fR]
60 The \fBulimit\fR utility sets or reports the file-size writing limit imposed on
61 files written by the shell and its child processes (files of any size can be
62 read). Only a process with appropriate privileges can increase the limit.
66 The Bourne shell built-in function, \fBulimit\fR, prints or sets hard or soft
67 resource limits. These limits are described in \fBgetrlimit\fR(2).
70 If \fIlimit\fR is not present, \fBulimit\fR prints the specified limits. Any
71 number of limits can be printed at one time. The \fB-a\fR option prints all
75 If \fIlimit\fR is present, \fBulimit\fR sets the specified limit to\fIlimit\fR.
76 The string \fBunlimited\fR requests that the current limit, if any, be removed.
77 Any user can set a soft limit to any value less than or equal to the hard
78 limit. Any user can lower a hard limit. Only a user with appropriate privileges
79 can raise or remove a hard limit. See \fBgetrlimit\fR(2).
82 The \fB-H\fR option specifies a hard limit. The \fB-S\fR option specifies a
83 soft limit. If neither option is specified, \fBulimit\fR sets both limits and
84 prints the soft limit.
87 The following options specify the resource whose limits are to be printed or
88 set. If no option is specified, the file size limit is printed or set.
95 Maximum core file size (in 512-byte blocks)
104 Maximum size of data segment or heap (in Kbytes)
113 Maximum file size (in 512-byte blocks)
122 Maximum file descriptor plus 1
131 Maximum size of stack segment (in Kbytes)
140 Maximum CPU time (in seconds)
149 Maximum size of virtual memory (in Kbytes)
155 The C-shell built-in function, \fBlimit\fR, limits the consumption by the
156 current process or any process it spawns, each not to exceed \fIlimit\fR on the
157 specified \fIresource\fR. The string \fBunlimited\fR requests that the current
158 limit, if any, be removed. If \fIlimit\fR is omitted, prints the current limit.
159 If \fIresource\fR is omitted, displays all limits.
166 Use hard limits instead of the current limits. Hard limits impose a ceiling on
167 the values of the current limits. Only the privileged user can raise the hard
173 \fIresource\fR is one of:
180 Maximum \fBCPU\fR seconds per process.
189 Largest single file allowed. Limited to the size of the filesystem (see
199 The maximum size of a process's heap in kilobytes.
205 \fB\fBstacksize\fR\fR
208 Maximum stack size for the process. The default stack size is 2^64.
214 \fB\fBcoredumpsize\fR\fR
217 Maximum size of a core dump (file). This is limited to the size of the
224 \fB\fBdescriptors\fR\fR
227 Maximum number of file descriptors. Run the \fBsysdef\fR(1M) command to obtain
228 the maximum possible limits for your system. The values reported are in
229 hexadecimal, but can be translated into decimal numbers using the \fBbc\fR(1)
236 \fB\fBmemorysize\fR\fR
239 Maximum size of virtual memory.
244 \fIlimit\fR is a number, with an optional scaling factor, as follows:
251 Hours (for \fBcputime\fR).
260 \fIn\fR kilobytes. This is the default for all but \fBcputime\fR.
269 \fIn\fR megabytes or minutes (for \fBcputime\fR).
275 \fB\fImm\fR\fB:\fR\fIss\fR\fR
278 Minutes and seconds (for \fBcputime\fR).
283 \fBunlimit\fR removes a limitation on \fIresource\fR. If no \fIresource\fR is
284 specified, then all resource limitations are removed. See the description of
285 the \fBlimit\fR command for the list of resource names.
292 Remove corresponding hard limits. Only the privileged user can do this.
298 The Korn shell built-in function, \fBulimit\fR, sets or displays a resource
299 limit. The available resources limits are listed below. Many systems do not
300 contain one or more of these limits. The limit for a specified resource is set
301 when \fIlimit\fR is specified. The value of \fIlimit\fR can be a number in the
302 unit specified below with each resource, or the value \fBunlimited\fR. The
303 string \fBunlimited\fR requests that the current limit, if any, be removed. The
304 \fB-H\fR and \fB-S\fR flags specify whether the hard limit or the soft limit
305 for the specified resource is set. A hard limit cannot be increased once it is
306 set. A soft limit can be increased up to the value of the hard limit. If
307 neither the \fB-H\fR or \fB-S\fR options is specified, the limit applies to
308 both. The current resource limit is printed when \fIlimit\fR is omitted. In
309 this case, the soft limit is printed unless \fB-H\fR is specified. When more
310 than one resource is specified, then the limit name and unit is printed before
318 Lists all of the current resource limits.
327 The number of 512-byte blocks on the size of core dumps.
336 The number of K-bytes on the size of the data area.
345 The number of 512-byte blocks on files written by child processes (files of any
355 The number of file descriptors plus 1.
364 The number of K-bytes on the size of the stack area.
373 The number of seconds (CPU time) to be used by each process.
382 The number of K-bytes for virtual memory.
387 If no option is specified, \fB-f\fR is assumed.
388 .SS "Per-Shell Memory Parameters"
391 The \fBheapsize\fR, \fBdatasize\fR, and \fBstacksize\fR parameters are not
392 system tunables. The only controls for these are hard limits, set in a shell
393 startup file, or system-wide soft limits, which, for the current version of the
394 Solaris OS, is 2^64bytes.
398 \fBulimit\fR sets or displays resource limits. These limits apply to the
399 current process and to each child process created after the resource limit has
400 been set. If \fIlimit\fR is specified, the resource limit is set, otherwise,
401 its current value is displayed on standard output.
404 Increasing the limit for a resource usually requires special privileges. Some
405 systems allow you to lower resource limits and later increase them. These are
406 called soft limits. Once a hard limit is set the resource cannot be increased.
409 Different systems allow you to specify different resources and some restrict
410 how much you can raise the limit of the resource.
413 The value of \fIlimit\fR depends on the unit of the resource listed for each
414 resource. In addition, \fIlimit\fR can be "unlimited" to indicate no limit for
418 If you do not specify \fB-H\fR or \fB-S\fR, \fB-S\fR is used for listing and
419 both \fB-S\fR and \fB-H\fR are used for setting resources.
422 If you do not specify any resource, the default is \fB-f.\fR
425 The following options are available for \fBulimit\fR in \fBksh93\fR:
432 Displays all current resource limits.
445 Specifies the socket buffer size in bytes.
458 Specifies the core file size in blocks.
471 Specifies the data size in kbytes.
484 Specifies the file size in blocks.
493 Displays or sets a hard limit.
506 Specifies the number of file locks.
516 \fB\fB--memlock\fR\fR
519 Specifies the locked address space in Kbytes.
532 Specifies the address space limit in Kbytes.
545 Specifies the number of open files.
558 Specifies the pipe buffer size in bytes.
571 Specifies the resident set size in Kbytes
580 Displays or sets a soft limit.
593 Specifies the stack size in Kbytes.
603 \fB\fB--threads\fR\fR
606 Specifies the number of threads.
619 Specifies the CPU time in seconds.
632 Specifies the number of processes.
645 Specifies the process size in Kbytes.
651 The following option is supported by \fB/usr/bin/ulimit\fR:
658 Sets (or reports, if no \fIblocks\fR operand is present), the file size limit
659 in blocks. The \fB-f\fR option is also the default case.
665 The following operand is supported by \fB/usr/bin/ulimit\fR:
672 The number of 512-byte blocks to use as the new file size limit.
676 .SS "/usr/bin/ulimit"
678 \fBExample 1 \fRLimiting the Stack Size
681 The following example limits the stack size to 512 kilobytes:
686 example% \fBulimit -s 512\fR
687 example% \fBulimit -a\fR
688 time(seconds) unlimited
693 nofiles(descriptors) 64
694 memory(kbytes) unlimited
701 \fBExample 2 \fRLimiting the Number of File Descriptors
704 The following command limits the number of file descriptors to 12:
709 example$ \fBulimit -n 12\fR
710 example$ \fBulimit -a\fR
711 time(seconds) unlimited
716 nofiles(descriptors) 12
717 vmemory(kbytes) unlimited
724 \fBExample 3 \fRLimiting the Core Dump File Size
727 The following command limits the size of a core dump file size to 0 kilobytes:
732 example% \fBlimit coredumpsize 0\fR
736 datasize 523256 kbytes
737 stacksize 8192 kbytes
738 coredumpsize 0 kbytes
746 \fBExample 4 \fRRemoving the limitation for core file size
749 The following command removes the above limitation for the core file size:
754 example% \fBunlimit coredumpsize\fR
758 datasize 523256 kbytes
759 stacksize 8192 kbytes
760 coredumpsize unlimited
767 .SH ENVIRONMENT VARIABLES
770 See \fBenviron\fR(5) for descriptions of the following environment variables
771 that affect the execution of \fBulimit\fR: \fBLANG\fR, \fBLC_ALL\fR,
772 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
776 The following exit values are returned by \fBulimit\fR:
783 Successful completion.
792 A request for a higher limit was rejected or an error occurred.
798 See \fBattributes\fR(5) for descriptions of the following attributes:
799 .SS "/usr/bin/ulimit, csh, ksh, sh"
807 ATTRIBUTE TYPE ATTRIBUTE VALUE
809 Interface Stability Committed
811 Standard See \fBstandards\fR(5).
822 ATTRIBUTE TYPE ATTRIBUTE VALUE
824 Interface Stability Uncommitted
830 \fBbc\fR(1), \fBcsh\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBsh\fR(1),
831 \fBdf\fR(1M), \fBsu\fR(1M), \fBswap\fR(1M), \fBsysdef\fR(1M),
832 \fBgetrlimit\fR(2), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)