Ulimit command parameters and usage

Source: Internet
Author: User


Ulimit command parameters and usage Description: Controls shell program resources. Note: ulimit is a shell built-in command that can be used to control shell execution program resources. Parameters:-a displays the current resource limit settings. -C sets the maximum value of the core file, in blocks. -D <Data Partition size> maximum value of the Program Data Partition, in KB. -F <file size> the maximum file that can be created by shell. The unit is block. -H: Set the hard limit of resources, that is, the limit set by the Administrator. -M <memory size> specifies the maximum memory available, in KB. -N <file quantity> specifies the maximum number of files that can be opened at the same time. -P <buffer size> specifies the size of the MPs queue buffer, in 512 bytes. -S <stack size> specifies the maximum number of stacks, in KB. -S: Set the elastic limit of resources. -T specifies the maximum CPU usage time, in seconds. -U <program count> the maximum number of programs that can be opened by users. -V <virtual memory size> specifies the upper limit of virtual memory available, in KB. Www.2cto.com ulimit-a to view all the limits. 01 core file size (blocks,-c) 002 data seg size (kbytes,-d) unlimited03scheduling priority (-e) 004 file size (blocks,-f) unlimited05pending signals (-I) 25659006max locked memory (kbytes,-l) 6407max memory size (kbytes,-m) unlimited08open files (-n) 102409 pipe size (512 bytes,-p) 810 POSIX message queues (bytes,-q) 81920011real-time priority (-r) 012 stack size (k Bytes,-s) 1024013cpu time (seconds,-t) unlimited14max user processes (-u) 8092015 virtual memory (kbytes,-v) unlimited16file locks (-x) unlimited: The ulimit-HSn 65536 command can be used immediately. ulimit-u 80920 does not take effect immediately in centos 6.2. You also need to modify vim/etc/security/limits. d/90-nproc.conf should be caused by the new feature www.2cto.com 1 # Default limit for number of user's processes to prevent2 # accidental fork bombs.3 # See rhbz #432903 for reasoning.4 5 * Soft nproc 80920 Note:/etc/security/limits. conf www.2cto.com limits. how conf works: limits. the backend of conf works like this: limits. conf is the configuration file of pam_limits.so, And then/etc/pam. d/The application under calls pam _***. so module. For example, when a user accesses the server, the service program sends the request to the PAM module. The PAM module sends the request to/etc/pam according to the service name. d directory, select a corresponding service file, and then select a specific PAM module based on the service file content for processing. Limits. conf format 01 # <domain> can be: 02 #-an user name03 #-a group name, with @ group syntax04 #-the wildcard *, for default entry05 #-the wildcard %, can be also used with % group syntax, 06 # for maxlogin limit07 sets the user name to be restricted. the group name is preceded by @ and the user name. You can also use wildcard * to restrict all users. 08 # <type> can have the two values: 09 #-"soft" for enforcing the soft limits10 #-"hard" for enforcing hard limits11hard indicates the maximum value that can be set in the system. Soft cannot be more restrictive than hard. Www.2cto.com 12 # <item> can be one of the following: 13 #-core-limits the core file size (KB) 14 core-limit the Kernel File size by 15 #-data-max data size (KB) 16 date-maximum data size 17 #-fsize-maximum filesize (KB) 18 fsize-maximum file size 19 #-memlock-max locked-in-memory address space (KB) 20 memlock-maximum lock memory address space 21 #-nofile-max number of open files22 nofile-Maximum number of opened files 23 #-rss-max resident set size (KB) 24 rss-maximum holding Long time setting size 25 #-stack-max stack size (KB) 26 stack-max stack size 27 #-cpu-max CPU time (MIN) 28 cpu-maximum CPU time in minutes 29 #-nproc-max number of processes30 noproc-Maximum number of processes 31 #-as-address space limit (KB) 32 as-address space limit 33 #-maxlogins-max number of logins for this user34 maxlogins-the maximum number of logins allowed by this user 35 #-maxsyslogins-max number of logins on the system36 # -priority-the priority to run user process wi Th37 #-locks-max number of file locks the user can hold38 #-sigpending-max number of pending signals39 #-msgqueue-max memory used by POSIX message queues (bytes) 40 #-nice-max nice priority allowed to raise to values: [-20, 19] 41 #-rtprio-max realtime priority42 #43 # <domain> <type> <item> <value> 44 #45 46 # * soft core 047 # * hard rss 1000048 # @ student hard nproc 2049 # @ faculty soft nproc 2 050 # @ faculty hard nproc 5051 # ftp hard nproc 052 # @ student-maxlogins 453 54 # End of file55mysql soft core 204800056 mysql hard core 204800057 mysql soft nofile 81920058 mysql hard nofile 819200 if you encounter "segment error" (segmentation fault) this problem occurs because the initial stack size of the Linux system is too small. You can use ulimit-s www.2cto.com core-to limit the size of the kernel file. What is the core file, when a program crashes, the stored images of the process are copied to the core file in the current working directory of the process. The core file is only a memory image (with debugging information added) and is mainly used for debugging. The core file is a binary file, and a corresponding tool is required to analyze the memory image when the program crashes. Nofile-the maximum number of opened files for applications that require many socket connections and make them open, it is best to use ulimit-n or set the nofile parameter, set the number of file descriptors to a higher value than the default value.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.