I am running into a problem all of a sudden; all my applications and the server was running fine and all of a sudden I see the number of open files shoot up.
I am checking it with this command:
cat /proc/sys/fs/file-nr
When I check with this it shows 44544 0 128000
, so 44544 is the number of open files.
But when I check with this command - lsof | wc -l
it shows - 28384.
So which one is correct?
My max open files limit is 65535
ulimit -a
open files (-n) 65535
I want to know the top 5 processes that are using more open files. I can get this from lsof
but the count shown here is very different from the other command I mentioned above.
Can I get the details of the processes counted by this command cat /proc/sys/fs/file-nr
?
According to the below mentioned link it says we cannot, How to display open file descriptors but not using lsof command
Is there a work around for me? I need to find which process started using more open files all of a sudden.
UPDATE Sorry guys for the trouble . I found the mistake which i was doing i was NOT checking lsof|wc -l from root. that is the reason i was seeing a huge difference.
still there is a difference between the output of file -nr and lsof | wc -l (from root). lsof count is more than file -nr count. the reason for this is , file -nr ignores some of the directories (which are considered as files by lsof) i found this reason by a litle research on google itself. anyways! thanks guys for all the help!
lsof | wc -l
really showing a negative number?