在 CentOS 中查看 ulimit 值,您可以使用以下方法:
方法一:使用 ulimit
命令
- 打开终端。
- 输入
ulimit -a
命令,然后按 Enter 键。 - 您将看到一系列的资源限制值,包括打开文件描述符的数量、进程数等。
示例输出:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 128768
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
方法二:查看 /etc/security/limits.conf
文件
- 打开终端。
- 输入
sudo cat /etc/security/limits.conf
命令,然后按 Enter 键。 - 您将看到一些限制设置,例如:
* soft nproc 1024
* hard nproc 4096
* soft nofile 1024
* hard nofile 4096
这些设置将限制所有用户可以创建的最大进程数(nproc)和打开文件描述符的数量(nofile)。您可以根据需要修改这些值。