ulimit 资源限制
ulimit 可以限制用户进程的资源使用(如打开文件数、内存等)。
示例:
# 查看当前限制
ulimit -a
# 设置最大打开文件数(软限制)
ulimit -n 65535
# 设置硬限制(需 root)
ulimit -Hn 65535永久配置:编辑 /etc/security/limits.conf:
* soft nofile 65535
* hard nofile 65535 欢迎来到程序员中文网!
ulimit 可以限制用户进程的资源使用(如打开文件数、内存等)。
示例:
# 查看当前限制
ulimit -a
# 设置最大打开文件数(软限制)
ulimit -n 65535
# 设置硬限制(需 root)
ulimit -Hn 65535永久配置:编辑 /etc/security/limits.conf:
* soft nofile 65535
* hard nofile 65535