Ubuntu Server上執行以下命令,可以看到默認打開的文件數限制為1024個。
$ ulimit -n
1024
編輯/etc/profile配置文件,在最後添加一行:
ulimit -SHn 65535
要讓配置生效:
$ sudo source /etc/profile
sudo: source: command not found
我們直接執行ulimit -SHn 65535命令又會怎麼樣呢?
$ ulimit -SHn 65535
-bash: ulimit: open files: cannot modify limit: Operation not permitted
$ sudo ulimit -SHn 65535
sudo: ulimit: command not found
普通用戶獲得root權限後反而提示找不到命令了,該如何解決這個問題呢?
$ sudo -s
# source /etc/profile
再次執行ulimit,可以看到打開文件的限制數已改為65535了。
# ulimit -n
65535
更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2