1limit(1)                         User Commands                        limit(1)
2
3
4

NAME

6       limit, ulimit, unlimit - set or get limitations on the system resources
7       available to the current shell and its descendents
8

SYNOPSIS

10       /usr/bin/ulimit [-f] [blocks]
11
12
13   sh
14       ulimit [- [HS] [a | cdfnstv]]
15
16
17       ulimit [- [HS] [c | d | f | n | s | t | v]] limit
18
19
20   csh
21       limit [-h] [resource [limit]]
22
23
24       unlimit [-h] [resource]
25
26
27   ksh
28       ulimit [-HSacdfnstv] [limit]
29
30
31   ksh93
32       ulimit [-HSacdfmnpstv] [limit]
33
34

DESCRIPTION

36   /usr/bin/ulimit
37       The ulimit utility sets or reports the file-size writing limit  imposed
38       on  files  written  by  the shell and its child processes (files of any
39       size can be read). Only  a  process  with  appropriate  privileges  can
40       increase the limit.
41
42   sh
43       The Bourne shell built-in function, ulimit, prints or sets hard or soft
44       resource limits. These limits are described in getrlimit(2).
45
46
47       If limit is not present, ulimit prints the specified limits. Any number
48       of limits can be printed at one time. The -a option prints all limits.
49
50
51       If  limit  is  present,  ulimit  sets  the specified limit tolimit. The
52       string unlimited requests that the current limit, if any,  be  removed.
53       Any  user  can  set a soft limit to any value less than or equal to the
54       hard limit. Any user can lower a hard limit. Only a user with appropri‐
55       ate privileges can raise or remove a hard limit. See getrlimit(2).
56
57
58       The  -H  option  specifies a hard limit. The -S option specifies a soft
59       limit. If neither option is specified,  ulimit  sets  both  limits  and
60       prints the soft limit.
61
62
63       The  following  options  specify  the  resource  whose limits are to be
64       printed or set. If no option is  specified,  the  file  size  limit  is
65       printed or set.
66
67       -c    Maximum core file size (in 512-byte blocks)
68
69
70       -d    Maximum size of data segment or heap (in Kbytes)
71
72
73       -f    Maximum file size (in 512-byte blocks)
74
75
76       -n    Maximum file descriptor plus 1
77
78
79       -s    Maximum size of stack segment (in Kbytes)
80
81
82       -t    Maximum CPU time (in seconds)
83
84
85       -v    Maximum size of virtual memory (in Kbytes)
86
87
88   csh
89       The  C-shell  built-in  function,  limit, limits the consumption by the
90       current process or any process it spawns, each not to exceed  limit  on
91       the  specified resource. The string unlimited requests that the current
92       limit, if any, be removed. If limit  is  omitted,  prints  the  current
93       limit. If resource is omitted, displays all limits.
94
95       -h    Use hard limits instead of the current limits. Hard limits impose
96             a ceiling on the values of the current limits.  Only  the  privi‐
97             leged user can raise the hard limits.
98
99
100
101       resource is one of:
102
103       cputime         Maximum CPU seconds per process.
104
105
106       filesize        Largest single file allowed. Limited to the size of the
107                       filesystem (see df(1M)).
108
109
110       datasize        The maximum size of a process's heap in kilobytes.
111
112
113       stacksize       Maximum stack size for the process. The  default  stack
114                       size is 2^64.
115
116
117       coredumpsize    Maximum  size of a core dump (file). This is limited to
118                       the size of the filesystem.
119
120
121       descriptors     Maximum number of file descriptors. Run the  sysdef(1M)
122                       command  to obtain the maximum possible limits for your
123                       system. The values reported are in hexadecimal, but can
124                       be translated into decimal numbers using the bc(1) com‐
125                       mand.
126
127
128       memorysize      Maximum size of virtual memory.
129
130
131
132       limit is a number, with an optional scaling factor, as follows:
133
134       nh       Hours (for cputime).
135
136
137       nk       n kilobytes. This is the default for all but cputime.
138
139
140       nm       n megabytes or minutes (for cputime).
141
142
143       mm:ss    Minutes and seconds (for cputime).
144
145
146
147       unlimit removes a limitation on resource. If no resource is  specified,
148       then  all  resource limitations are removed. See the description of the
149       limit command for the list of resource names.
150
151       -h    Remove corresponding hard limits. Only the privileged user can do
152             this.
153
154
155   ksh
156       The  Korn  shell built-in function, ulimit, sets or displays a resource
157       limit. The available resources limits are listed below. Many systems do
158       not  contain  one  or  more  of these limits. The limit for a specified
159       resource is set when limit is specified. The value of limit  can  be  a
160       number  in  the  unit  specified below with each resource, or the value
161       unlimited. The string unlimited requests that  the  current  limit,  if
162       any,  be removed. The -H and -S flags specify whether the hard limit or
163       the soft limit for the specified resource is set. A hard  limit  cannot
164       be  increased  once  it is set. A soft limit can be increased up to the
165       value of the hard limit. If neither the -H or -S options is  specified,
166       the  limit  applies to both. The current resource limit is printed when
167       limit is omitted. In this case, the soft limit is printed unless -H  is
168       specified.  When  more  than  one resource is specified, then the limit
169       name and unit is printed before the value.
170
171       -a    Lists all of the current resource limits.
172
173
174       -c    The number of 512-byte blocks on the size of core dumps.
175
176
177       -d    The number of K-bytes on the size of the data area.
178
179
180       -f    The number of 512-byte blocks on files written by child processes
181             (files of any size can be read).
182
183
184       -n    The number of file descriptors plus 1.
185
186
187       -s    The number of K-bytes on the size of the stack area.
188
189
190       -t    The number of seconds (CPU time) to be used by each process.
191
192
193       -v    The number of K-bytes for virtual memory.
194
195
196
197       If no option is specified, -f is assumed.
198
199   Per-Shell Memory Parameters
200       The  heapsize,  datasize,  and stacksize parameters are not system tun‐
201       ables. The only controls for these are hard  limits,  set  in  a  shell
202       startup  file,  or system-wide soft limits, which, for the current ver‐
203       sion of the Solaris OS, is 2^64bytes.
204
205   ksh93
206       ulimit sets or displays resource limits. These limits apply to the cur‐
207       rent process and to each child process created after the resource limit
208       has been set. If limit is specified, the resource limit is set,  other‐
209       wise, its current value is displayed on standard output.
210
211
212       Increasing  the  limit  for  a resource usually requires special privi‐
213       leges. Some systems allow  you  to  lower  resource  limits  and  later
214       increase  them.  These are called soft limits. Once a hard limit is set
215       the resource cannot be increased.
216
217
218       Different systems allow you to specify  different  resources  and  some
219       restrict how much you can raise the limit of the resource.
220
221
222       The  value of limit depends on the unit of the resource listed for each
223       resource. In addition, limit can be "unlimited" to  indicate  no  limit
224       for that resource.
225
226
227       If  you do not specify -H or -S, -S is used for listing and both -S and
228       -H are used for setting resources.
229
230
231       If you do not specify any resource, the default is -f.
232
233
234       The following options are available for ulimit in ksh93:
235
236       -a           Displays all current resource limits.
237
238
239       -b           Specifies the socket buffer size in bytes.
240       --sbsize
241
242       -c           Specifies the core file size in blocks.
243       --core
244
245       -d           Specifies the data size in kbytes.
246       --data
247
248       -f           Specifies the file size in blocks.
249       --fsize
250
251       -H           Displays or sets a hard limit.
252
253
254       -L           Specifies the number of file locks.
255       --locks
256
257       -l           Specifies the locked address space in Kbytes.
258       --memlock
259
260       -M           Specifies the address space limit in Kbytes.
261       --as
262
263       -n           Specifies the number of open files.
264       --nofile
265
266       -p           Specifies the pipe buffer size in bytes.
267       --pipe
268
269       -m           Specifies the resident set size in Kbytes
270       --rss
271
272       -S           Displays or sets a soft limit.
273
274
275       -s           Specifies the stack size in Kbytes.
276       --stack
277
278       -T           Specifies the number of threads.
279       --threads
280
281       -t           Specifies the CPU time in seconds.
282       --cpu
283
284       -u           Specifies the number of processes.
285       --nproc
286
287       -v           Specifies the process size in Kbytes.
288       --vmem
289

OPTIONS

291       The following option is supported by /usr/bin/ulimit:
292
293       -f    Sets (or reports, if no blocks operand is present), the file size
294             limit in blocks. The -f option is also the default case.
295
296

OPERANDS

298       The following operand is supported by /usr/bin/ulimit:
299
300       blocks    The  number  of  512-byte  blocks to use as the new file size
301                 limit.
302
303

EXAMPLES

305   /usr/bin/ulimit
306       Example 1 Limiting the Stack Size
307
308
309       The following example limits the stack size to 512 kilobytes:
310
311
312         example% ulimit -s 512
313         example% ulimit -a
314         time(seconds)         unlimited
315         file(blocks)            100
316         data(kbytes)            523256
317         stack(kbytes)           512
318         coredump(blocks)        200
319         nofiles(descriptors)    64
320         memory(kbytes)          unlimited
321
322
323
324   sh/ksh
325       Example 2 Limiting the Number of File Descriptors
326
327
328       The following command limits the number of file descriptors to 12:
329
330
331         example$ ulimit -n 12
332         example$ ulimit -a
333         time(seconds)            unlimited
334         file(blocks)             41943
335         data(kbytes)             523256
336         stack(kbytes)            8192
337         coredump(blocks)         200
338         nofiles(descriptors)     12
339         vmemory(kbytes)          unlimited
340
341
342
343   csh
344       Example 3 Limiting the Core Dump File Size
345
346
347       The following command limits the size of a core dump  file  size  to  0
348       kilobytes:
349
350
351         example% limit coredumpsize 0
352         example% limit
353         cputime                 unlimited
354         filesize                unlimited
355         datasize                523256 kbytes
356         stacksize               8192 kbytes
357         coredumpsize            0 kbytes
358         descriptors             64
359         memorysize              unlimited
360
361
362
363       Example 4 Removing the limitation for core file size
364
365
366       The  following  command  removes the above limitation for the core file
367       size:
368
369
370         example% unlimit coredumpsize
371         example% limit
372         cputime                 unlimited
373         filesize                unlimited
374         datasize                523256 kbytes
375         stacksize               8192 kbytes
376         coredumpsize            unlimited
377         descriptors             64
378         memorysize              unlimited
379
380
381

ENVIRONMENT VARIABLES

383       See environ(5) for descriptions of the following environment  variables
384       that  affect  the  execution of ulimit: LANG, LC_ALL, LC_CTYPE, LC_MES‐
385       SAGES, and NLSPATH.
386

EXIT STATUS

388       The following exit values are returned by ulimit:
389
390       0     Successful completion.
391
392
393       >0    A request for a higher limit was rejected or an error occurred.
394
395

ATTRIBUTES

397       See attributes(5) for descriptions of the following attributes:
398
399   /usr/bin/ulimit, csh, ksh, sh
400       ┌─────────────────────────────┬─────────────────────────────┐
401       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
402       ├─────────────────────────────┼─────────────────────────────┤
403       │Availability                 │SUNWcsu                      │
404       ├─────────────────────────────┼─────────────────────────────┤
405       │Interface Stability          │Committed                    │
406       ├─────────────────────────────┼─────────────────────────────┤
407       │Standard                     │See standards(5).            │
408       └─────────────────────────────┴─────────────────────────────┘
409
410   ksh93
411       ┌─────────────────────────────┬─────────────────────────────┐
412       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
413       ├─────────────────────────────┼─────────────────────────────┤
414       │Availability                 │SUNWcsu                      │
415       ├─────────────────────────────┼─────────────────────────────┤
416       │Interface Stability          │Uncommitted                  │
417       └─────────────────────────────┴─────────────────────────────┘
418

SEE ALSO

420       bc(1), csh(1), ksh(1), ksh93(1), sh(1), df(1M), su(1M), swap(1M),  sys‐
421       def(1M), getrlimit(2), attributes(5), environ(5), standards(5)
422
423
424
425SunOS 5.11                        2 Nov 2007                          limit(1)
Impressum