====== ulimit ====== Linux 系统通过 `ulimit` 来限制用户能打开的资源数量。 ===== Usage ===== 查看 ''ulimit'' : ulimit -n # 查看当前可打开的最大文件描述符数 ulimit -Sn ulimit -Hn ''-H'' 表示 hard limit,系统设置的硬限制,非 root 用户不可调 ''-S'' 表示 soft limit,用户可调软限制上限到硬限制 修改 ''ulimit'' : ulimit -n 65535 # 仅在当前 session 下有效 ===== Config ===== 编辑 ''/etc/security/limits.conf'' 文件: * soft nofile 65535 * hard nofile 65535 重新登录后生效 ===== Reference ===== * [[https://wiki.debian.org/Limits|Debian Wiki]] * [[http://www.chengweiyang.cn/2015/11/14/how-to-enlarge-linux-open-files-upper-cell/|怎样增大 Linux 系统的 open file(s) 上限]] * [[https://www.ibm.com/developerworks/cn/linux/l-cn-ulimit/|通过 ulimit 改善系统性能]]