Check number of file descriptors opened by process
Fri, 03/25/2011 - 11:51 — sandipTo check on the file descriptors opened by process:
lsof -p {PID} | awk '$4 ~ /^[0-9]/ {print $4}' | wc -l
alternately:
ls -1 /proc/{PID}/fd | wc -l
To check all file descriptors opened by a user:
lsof -u {user} | awk '$4 ~ /^[0-9]/ {print $4}' | wc -l
By default the hard and soft limits for a single process are set to 1024 on linux systems. To check on the limits:
ulimit -Hn
ulimit -Sn
To increase edit the "/etc/security/limits.conf" file for corresponding user:
{user} soft nofile 4096
{user} hard nofile 4096
To check if the new limits has been applied type `ulimit -n` after you get a new shell.