File description limit

Things that can be done:

  • sysctl -w fs.file-max=100000 : set system-wide limit
  • cat /proc/sys/fs/file-nr : shows number of opened files by all processes
  • cat /proc/sys/fs/file-max : shows system-level max number of opened files
  • cat /proc/5/limits | grep files : shows file limits for a process with pid 3
  • ls -la /proc/5/fd | wc -l : shows opened files by process with pid 3
  • lsof -p 5 | wc -l : another way to see files opened by process
  • ulimit -n : shows soft limit, must be less than hard limit
  • ulimit -Hn : shows hard limit
  • ulimit -n  : sets soft limit for current process
  • ulimit -Hn  : sets hard limit for current process
  • cat /etc/sysctl.conf
  • https://github.com/soldair/docker-alpine-elasticsearch/blob/master/start.sh : shows how set limits

$ sysctl -a | grep fs.
fs.file-max = 100000
fs.file-nr = 1024          0       100000
Go to index of articles.

Share on