Ulimit is a shell-built directive that can be used to control the resources of shell execution programs.
Grammar
ulimit [-ahs][-c <core file Caps >][-d < data section size >][-f < file size >][-m < memory size]
[-N < number of files] [-p < buffer size] [-s < stacking size] [t <cpu time] [-U < Program number] [-v < virtual memory size]
Parameters:
- -a displays the current resource constraint settings.
- -c <core File upper limit > set the maximum value of core file, the unit is block.
- -D < data section size > The maximum value of the data section of the program, in kilobytes.
- -F < file size > The largest file the shell can establish, in blocks.
- -H set the hard limit of the resource, which is the limit set by the administrator.
- -m < memory size > Specifies the maximum amount of memory that can be used, in kilobytes.
- -N < number of files > Specify the maximum number of files that can be opened at the same time.
- -p < buffer size > Specifies the size of the pipe buffer, in units of 512 bytes.
- -s < stacking size > Specifies the upper bound of the stack in kilobytes.
- -S sets the flexibility limit for resources.
- -T <CPU time > Specify the maximum CPU usage time in seconds.
- -U < number of programs > The maximum number of programs that users can open.
- -v < virtual memory size > Specify the maximum amount of virtual memory that can be used, in kilobytes.
Instance
To display system resource settings
[Root@w3cschool.cc ~]# Ulimit-a
Core file size (blocks,-c) 0
Data seg Size (Kbytes,-D) Unlimited
File size (blocks,-f) Unlimited
Pending Signals (I.) 1024
Max locked Memory (Kbytes, L) 32
Max memory Size (Kbytes, M) Unlimited
Open files (-N) 1024
Pipe Size (bytes, p) 8
POSIX message queues (bytes,-Q) 819200
Stack size (Kbytes,-s) 10240
CPU time (seconds,-t) unlimited
MAX User Processes (-u) 4096
Virtual Memory (Kbytes,-V) Unlimited
File locks (-X) Unlimited
[Root@w3cschool.cc ~]#
Set the maximum number of single user programs
[root@w3cschool.cc ~]# ulimit-u 500//Set a single user program limit
[Root@w3cschool.cc ~]# Ulimit-a
Core file size (blocks,-c) 0
Data seg Size (Kbytes,-D) Unlimited
File size (blocks,-f) Unlimited
Pending Signals (I.) 1024
Max locked Memory (Kbytes, L) 32
Max memory Size (Kbytes, M) Unlimited
Open files (-N) 1024
Pipe Size (bytes, p) 8
POSIX message queues (bytes,-Q) 819200
Stack size (Kbytes,-s) 10240
CPU time (seconds,-t) unlimited
MAX User Processes (-u) 500
Virtual Memory (Kbytes,-V) Unlimited
File locks (-X) Unlimited
[Root@w3cschool.cc ~]#