What's the correct way of consulting the number of open files on a Linux system. I know that both sysctl fs.file-nr, cat /proc/sys/fs/file-nr and lsof can report this number. The problem that in my case lsof is reporting a huge number in comparison with the fs.file-nr. Looks like lsof is showing duplicate entries: the same file descriptor appears several times but for different threads.

  • 2
    Depends on if you want to know open file handles or the number of actual files that have been opened. What is the purpose you need to know this number? – Tero Kilkanen Aug 11 '16 at 11:42
  • get the number of file descriptors in use – rkachach Aug 11 '16 at 13:02
  • Yes, but where are you going to use this number? – Tero Kilkanen Aug 11 '16 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.