Linux ulimit command
Linux ulimit shell command control program resources.
ulimit shell built-in commands to be used to control resource shell program execution.
grammar
ulimit [-aHS][-c <core文件上限>][-d <数据节区大小>][-f <文件大小>][-m <内存大小>][-n <文件数目>][-p <缓冲区大小>][-s <堆叠大小>][-t <CPU时间>][-u <程序数目>][-v <虚拟内存大小>]
Parameters:
- -a Displays the current resource limit settings.
- -c <core file limit> Set the maximum core file, in units of blocks.
- -d <data section area size> maximum program data section area, in units of KB.
- Maximum file -f <size> shell can be established, in units of blocks.
- -H Setting a hard limit of resources, which is the limit set by the administrator.
- -m <memory size> can be used to specify the upper limit of the memory unit is KB.
- The number of files -n <number of files> Specifies the same time open up.
- -p <buffer size> Specify the size of the pipe buffer, 512 units of bytes.
- -s <stack-size> specifies the upper limit of the stack, in units of KB.
- -S Setting the elastic limit of resources.
- -t <CPU time> specify the maximum time of CPU, in seconds.
- -u <program number> The number of procedures that open up to the user.
- -v <virtual memory size> Specifies the maximum virtual memory that can be used, in units of KB.
Examples
Setting Display System Resources
[[email protected] ~]# 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 (512 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 [[email protected] ~]#
Set the maximum number of single-user program
[[email protected] ~]# ulimit -u 500 //设置单一用户程序上限 [[email protected] ~]# 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 (512 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 [[email protected] ~]#