1

we have in our cluster more then 800 rhel machines - version 7.2

since lsof | wc -l

take too much time ( sometimes 3-4 min ) , in order to get the current open files

we want to know if there are other approach that can give the total current open files in short time

note - in our case , we have 835 linux machines , so it will be very bad to use lsof | wc -l on all machines , according to our calculation it will take 40~hours

King David
  • 433
  • 4
  • 17
  • Most lines counted by `lsof | wc -l` are not open files. In addition you may have to tell apart open files from file descriptors as several processes can have opened the same file. – Hauke Laging May 05 '20 at 01:07
  • The exactly same question, one hour apart, by different users...? https://unix.stackexchange.com/questions/584535/how-to-count-the-open-files-without-lsof – Hauke Laging May 05 '20 at 01:50

1 Answers1

1

As root:

find /proc/[1-9]*/fd/ -mindepth 1 -printf . 2>/dev/null | wc -c
Hauke Laging
  • 5,157
  • 2
  • 23
  • 40