2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
44 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
45 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
47 .TH LIMIT 1 "Nov 2, 2007"
49 limit, ulimit, unlimit \- set or get limitations on the system resources
50 available to the current shell and its descendents
54 \fB/usr/bin/ulimit\fR [\fB-f\fR] [\fIblocks\fR]
60 \fBulimit\fR [\fB-\fR [HS] [a | cdfnstv]]
65 \fBulimit\fR [\fB-\fR [HS] [c | d | f | n | s | t | v]] \fIlimit\fR
71 \fBlimit\fR [\fB-h\fR] [\fIresource\fR [\fIlimit\fR]]
76 \fBunlimit\fR [\fB-h\fR] [\fIresource\fR]
82 \fBulimit\fR [\fB-HSacdfnstv\fR] [\fIlimit\fR]
88 \fBulimit\fR [\fB-HSacdfmnpstv\fR] [\fIlimit\fR]
95 The \fBulimit\fR utility sets or reports the file-size writing limit imposed on
96 files written by the shell and its child processes (files of any size can be
97 read). Only a process with appropriate privileges can increase the limit.
101 The Bourne shell built-in function, \fBulimit\fR, prints or sets hard or soft
102 resource limits. These limits are described in \fBgetrlimit\fR(2).
105 If \fIlimit\fR is not present, \fBulimit\fR prints the specified limits. Any
106 number of limits can be printed at one time. The \fB-a\fR option prints all
110 If \fIlimit\fR is present, \fBulimit\fR sets the specified limit to\fIlimit\fR.
111 The string \fBunlimited\fR requests that the current limit, if any, be removed.
112 Any user can set a soft limit to any value less than or equal to the hard
113 limit. Any user can lower a hard limit. Only a user with appropriate privileges
114 can raise or remove a hard limit. See \fBgetrlimit\fR(2).
117 The \fB-H\fR option specifies a hard limit. The \fB-S\fR option specifies a
118 soft limit. If neither option is specified, \fBulimit\fR sets both limits and
119 prints the soft limit.
122 The following options specify the resource whose limits are to be printed or
123 set. If no option is specified, the file size limit is printed or set.
130 Maximum core file size (in 512-byte blocks)
139 Maximum size of data segment or heap (in Kbytes)
148 Maximum file size (in 512-byte blocks)
157 Maximum file descriptor plus 1
166 Maximum size of stack segment (in Kbytes)
175 Maximum CPU time (in seconds)
184 Maximum size of virtual memory (in Kbytes)
190 The C-shell built-in function, \fBlimit\fR, limits the consumption by the
191 current process or any process it spawns, each not to exceed \fIlimit\fR on the
192 specified \fIresource\fR. The string \fBunlimited\fR requests that the current
193 limit, if any, be removed. If \fIlimit\fR is omitted, prints the current limit.
194 If \fIresource\fR is omitted, displays all limits.
201 Use hard limits instead of the current limits. Hard limits impose a ceiling on
202 the values of the current limits. Only the privileged user can raise the hard
208 \fIresource\fR is one of:
215 Maximum \fBCPU\fR seconds per process.
224 Largest single file allowed. Limited to the size of the filesystem (see
234 The maximum size of a process's heap in kilobytes.
240 \fB\fBstacksize\fR\fR
243 Maximum stack size for the process. The default stack size is 2^64.
249 \fB\fBcoredumpsize\fR\fR
252 Maximum size of a core dump (file). This is limited to the size of the
259 \fB\fBdescriptors\fR\fR
262 Maximum number of file descriptors. Run the \fBsysdef\fR(8) command to obtain
263 the maximum possible limits for your system. The values reported are in
264 hexadecimal, but can be translated into decimal numbers using the \fBbc\fR(1)
271 \fB\fBmemorysize\fR\fR
274 Maximum size of virtual memory.
279 \fIlimit\fR is a number, with an optional scaling factor, as follows:
286 Hours (for \fBcputime\fR).
295 \fIn\fR kilobytes. This is the default for all but \fBcputime\fR.
304 \fIn\fR megabytes or minutes (for \fBcputime\fR).
310 \fB\fImm\fR\fB:\fR\fIss\fR\fR
313 Minutes and seconds (for \fBcputime\fR).
318 \fBunlimit\fR removes a limitation on \fIresource\fR. If no \fIresource\fR is
319 specified, then all resource limitations are removed. See the description of
320 the \fBlimit\fR command for the list of resource names.
327 Remove corresponding hard limits. Only the privileged user can do this.
333 The Korn shell built-in function, \fBulimit\fR, sets or displays a resource
334 limit. The available resources limits are listed below. Many systems do not
335 contain one or more of these limits. The limit for a specified resource is set
336 when \fIlimit\fR is specified. The value of \fIlimit\fR can be a number in the
337 unit specified below with each resource, or the value \fBunlimited\fR. The
338 string \fBunlimited\fR requests that the current limit, if any, be removed. The
339 \fB-H\fR and \fB-S\fR flags specify whether the hard limit or the soft limit
340 for the specified resource is set. A hard limit cannot be increased once it is
341 set. A soft limit can be increased up to the value of the hard limit. If
342 neither the \fB-H\fR or \fB-S\fR options is specified, the limit applies to
343 both. The current resource limit is printed when \fIlimit\fR is omitted. In
344 this case, the soft limit is printed unless \fB-H\fR is specified. When more
345 than one resource is specified, then the limit name and unit is printed before
353 Lists all of the current resource limits.
362 The number of 512-byte blocks on the size of core dumps.
371 The number of K-bytes on the size of the data area.
380 The number of 512-byte blocks on files written by child processes (files of any
390 The number of file descriptors plus 1.
399 The number of K-bytes on the size of the stack area.
408 The number of seconds (CPU time) to be used by each process.
417 The number of K-bytes for virtual memory.
422 If no option is specified, \fB-f\fR is assumed.
423 .SS "Per-Shell Memory Parameters"
426 The \fBheapsize\fR, \fBdatasize\fR, and \fBstacksize\fR parameters are not
427 system tunables. The only controls for these are hard limits, set in a shell
428 startup file, or system-wide soft limits, which, for the current version of the
429 Solaris OS, is 2^64bytes.
433 \fBulimit\fR sets or displays resource limits. These limits apply to the
434 current process and to each child process created after the resource limit has
435 been set. If \fIlimit\fR is specified, the resource limit is set, otherwise,
436 its current value is displayed on standard output.
439 Increasing the limit for a resource usually requires special privileges. Some
440 systems allow you to lower resource limits and later increase them. These are
441 called soft limits. Once a hard limit is set the resource cannot be increased.
444 Different systems allow you to specify different resources and some restrict
445 how much you can raise the limit of the resource.
448 The value of \fIlimit\fR depends on the unit of the resource listed for each
449 resource. In addition, \fIlimit\fR can be "unlimited" to indicate no limit for
453 If you do not specify \fB-H\fR or \fB-S\fR, \fB-S\fR is used for listing and
454 both \fB-S\fR and \fB-H\fR are used for setting resources.
457 If you do not specify any resource, the default is \fB-f.\fR
460 The following options are available for \fBulimit\fR in \fBksh93\fR:
467 Displays all current resource limits.
480 Specifies the socket buffer size in bytes.
493 Specifies the core file size in blocks.
506 Specifies the data size in kbytes.
519 Specifies the file size in blocks.
528 Displays or sets a hard limit.
541 Specifies the number of file locks.
551 \fB\fB--memlock\fR\fR
554 Specifies the locked address space in Kbytes.
567 Specifies the address space limit in Kbytes.
580 Specifies the number of open files.
593 Specifies the pipe buffer size in bytes.
606 Specifies the resident set size in Kbytes
615 Displays or sets a soft limit.
628 Specifies the stack size in Kbytes.
638 \fB\fB--threads\fR\fR
641 Specifies the number of threads.
654 Specifies the CPU time in seconds.
667 Specifies the number of processes.
680 Specifies the process size in Kbytes.
686 The following option is supported by \fB/usr/bin/ulimit\fR:
693 Sets (or reports, if no \fIblocks\fR operand is present), the file size limit
694 in blocks. The \fB-f\fR option is also the default case.
700 The following operand is supported by \fB/usr/bin/ulimit\fR:
707 The number of 512-byte blocks to use as the new file size limit.
711 .SS "/usr/bin/ulimit"
713 \fBExample 1 \fRLimiting the Stack Size
716 The following example limits the stack size to 512 kilobytes:
721 example% \fBulimit -s 512\fR
722 example% \fBulimit -a\fR
723 time(seconds) unlimited
728 nofiles(descriptors) 64
729 memory(kbytes) unlimited
736 \fBExample 2 \fRLimiting the Number of File Descriptors
739 The following command limits the number of file descriptors to 12:
744 example$ \fBulimit -n 12\fR
745 example$ \fBulimit -a\fR
746 time(seconds) unlimited
751 nofiles(descriptors) 12
752 vmemory(kbytes) unlimited
759 \fBExample 3 \fRLimiting the Core Dump File Size
762 The following command limits the size of a core dump file size to 0 kilobytes:
767 example% \fBlimit coredumpsize 0\fR
771 datasize 523256 kbytes
772 stacksize 8192 kbytes
773 coredumpsize 0 kbytes
781 \fBExample 4 \fRRemoving the limitation for core file size
784 The following command removes the above limitation for the core file size:
789 example% \fBunlimit coredumpsize\fR
793 datasize 523256 kbytes
794 stacksize 8192 kbytes
795 coredumpsize unlimited
802 .SH ENVIRONMENT VARIABLES
805 See \fBenviron\fR(5) for descriptions of the following environment variables
806 that affect the execution of \fBulimit\fR: \fBLANG\fR, \fBLC_ALL\fR,
807 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
811 The following exit values are returned by \fBulimit\fR:
818 Successful completion.
827 A request for a higher limit was rejected or an error occurred.
833 See \fBattributes\fR(5) for descriptions of the following attributes:
834 .SS "/usr/bin/ulimit, csh, ksh, sh"
842 ATTRIBUTE TYPE ATTRIBUTE VALUE
844 Interface Stability Committed
846 Standard See \fBstandards\fR(5).
857 ATTRIBUTE TYPE ATTRIBUTE VALUE
859 Interface Stability Uncommitted
865 \fBbc\fR(1), \fBcsh\fR(1), \fBksh\fR(1), \fBksh93\fR(1), \fBsh\fR(1),
866 \fBdf\fR(8), \fBsu\fR(8), \fBswap\fR(8), \fBsysdef\fR(8),
867 \fBgetrlimit\fR(2), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)