maximum number of open files and file descriptors in linux

To see open files in linux use the command

lsof

There is a limit set in the kernel on how many open file descriptors are allowed on the system. This may be compiled in, or it may be tunable on the fly. In Linux, the value of this parameter can be read from and written to the proc filesystem.

[root@server50 home]# cat /proc/sys/fs/file-max
131072
[root@server50 home]#

On this system 1,31,072 open file descriptors are permitted. We are unlikely to run out. If we wanted to change it, we’d do something like this:

echo "132096" > /proc/sys/fs/file-max 

But how do we know how many file descriptors are being used?

[root@server1 ~]# cat /proc/sys/fs/file-nr
1792    0       131072
|	 |       |
|	 |       |
|        |       maximum open file descriptors
|        total free allocated file descriptors
total allocated file descriptors
(the number of file descriptors allocated since boot)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *