English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux ulimit command

Linux Command大全

The Linux ulimit command is used to control the resources of shell programs.

ulimit is a built-in command in the shell, used to control the resources of the shell executing programs.

Syntax

ulimit [-aHS][-c <Core file limit>][-d <Data section size>][-f <File size>][-m <Memory size>][-n <Number of files>][-p <Buffer size>][-s <Stack size>][-t <CPU time>][-u <Number of programs>][-v <Virtual memory size>]

Parameters:

  • -a Display the current settings of resource limits.
  • -c <Core file limit> Set the maximum value of the core file, in blocks.
  • -d <Data section size> The maximum value of the program data section, in KB.
  • -f <File size> The largest file that the shell can create, in blocks.
  • -H Set the hard limit of resources, which is the limit set by the administrator.
  • -m <Memory size> Specify the upper limit of the memory that can be used, in KB.
  • -n <Number of files> Specify the maximum number of files that can be opened at the same time.
  • -p <Buffer size> Specify the size of the pipe buffer, in units512Bytes.
  • -s <Stack size> Specify the upper limit of the stack, in KB.
  • -S Set the elastic limit of resources.
  • -t <CPU time> Specify the upper limit of CPU usage time, in seconds.
  • -u <Number of programs> The maximum number of programs a user can open.
  • -v <Virtual memory size> Specify the upper limit of the virtual memory that can be used, in KB.

Online examples

Display the settings of 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 upper limit of the number of single user programs

[[email protected] ~]# ulimit -u 500 //Set Upper Limits for a Single User Program
[[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] ~]# 

Linux Command大全