2

How to get the current count of file descriptors in the system?

I know how to get the maximum.

% sysctl kern.maxfiles
kern.maxfiles: 8232

Ref:

http://www.freebsd.org/cgi/man.cgi?query=fstat&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE&arch=default&format=html

Figo
  • 1,700
  • 3
  • 15
  • 24

2 Answers2

6

Are you looking for kern.openfiles?

[ghoti@pc ~]$ sysctl -ad | grep 'kern.*files:'
kern.maxfiles: Maximum number of files
kern.openfiles: System-wide number of open files
[ghoti@pc ~]$ 
ghoti
  • 45,319
  • 8
  • 65
  • 104
-3

cat /proc/sys/fs/file-nr

Three columns are total file descriptors allocated since boot, free allocated file descriptors, maximum open file descriptors.

Additional info here.

nickgroenke
  • 1,472
  • 9
  • 12