首页  

linux ulimit命令总结     所属分类 linux 浏览量 1455
针对每个用户,限制使用的资源
ulimit 显示(或设置)用户资源限制 
查看当前用户的所有限制 ulimit -a 

-a 列出所有当前用户资源限制
-c 设置core文件的最大值.单位:blocks   1blocks = 512 bytes 
-d 设置进程数据段的最大值.单位:kbytes
-f shell创建文件的文件大小的最大值,单位:blocks
-h 设置某个资源的硬限制。如果用户拥有 root 用户权限,可以增大硬极限。任何用户均可减少硬极限
-l 可以锁住的物理内存的最大值
-m 可以使用的常驻内存的最大值,单位:kbytes
-n 每个进程可以打开的最大文件数
-p 设置管道的最大值,单位为block 
-s 指定堆栈的最大值:单位:kbytes
-S 设置源设置软限制。软限制可增大到硬限制的值。如果 -H 和 -S 都未指定,限制适用于以上二者
-t 指定每个进程所使用的秒数,单位:seconds
-u 可以运行的最大并发进程数
-v shell可使用的最大的虚拟内存,单位:kbytes

ulimit [-SHacdefilmnpqrstuvx] [限制]


core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 256661
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1000000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 256661
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

配置文件
/etc/security/limits.conf

* hard nofile 1000000
* soft nofile 1000000
* soft core unlimited
* soft stack 10240

* 表示所有用户



 - core - limits the core file size (KB)
 - data - max data size (KB)
 - fsize - maximum filesize (KB)
 - memlock - max locked-in-memory address space (KB)
 - nofile - max number of open file descriptors 
 - rss - max resident set size (KB)
 - stack - max stack size (KB)
 - cpu - max CPU time (MIN)
 - nproc - max number of processes 
 - as - address space limit (KB)
 - maxlogins - max number of logins for this user
 - maxsyslogins - max number of logins on the system
 - priority - the priority to run user process with
 - locks - max number of file locks the user can hol
 - sigpending - max number of pending signals
 - msgqueue - max memory used by POSIX message queues (bytes)
 - nice - max nice priority allowed to raise to values: [-20, 19]
 - rtprio - max realtime priority
 
 
linux 系统 最大文件打开数  
cat /proc/sys/fs/file-max
6514170
 
 
tcp 端口范围 
/etc/sysctl.conf
net.ipv4.ip_local_port_range = 1024 65000

内核最大连接数限制
net.ipv4.ip_conntrack_max = 10240


让配置生效
sysctl -p

上一篇     下一篇
2017年度五十大喜感新闻

2018年五十大喜感新闻

lucene知识点整理

linux之dmesg命令总结

linux性能分析及调优

linux系统性能分析工具sar总结