Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有 3 种方法可以在 Linux 上设置文件和套接字数量的限制:
echo "100000" > /proc/sys/fs/file-max
ulimit -n 100000
sysctl -w fs.file-max=100000
有什么区别?
在 Linux 上设置文件数量限制的最正确方法是什么?
sysctl是一个用于写入的接口,/proc/sys因此与直接回显到文件相同。虽然sysctl适用于整个文件系统,ulimit但仅适用于来自 shell 的写入和由 shell 启动的进程。
sysctl
/proc/sys
ulimit