Number of Files Opened: Difference between revisions
From Leo's Notes
This page was last edited on 1 September 2019, at 03:50.
m Text replacement - "Category:Linux " to "Category:Linux{{Navbox Linux}} " |
m formatting |
||
| Line 4: | Line 4: | ||
To show the number of files opened on a system, run: | To show the number of files opened on a system, run: | ||
{{highlight|lang=terminal|code= | |||
# cat /proc/sys/fs/file-nr | |||
1536 0 793120 | |||
}} | |||
The fields are: | The fields are: | ||
| Line 13: | Line 15: | ||
You may change this value by: | You may change this value by: | ||
{{highlight|lang=terminal|code= | |||
# cat <new value> > /proc/sys/fs/file-nr | # cat <new value> > /proc/sys/fs/file-nr | ||
# Edit {{code|/etc/sysctl.conf}} so that there is a line | ## Edit {{code|/etc/sysctl.conf}} so that there is a line | ||
# | ## fs.file-max = <new value> | ||
}} | |||
== Per-User Settings == | == Per-User Settings == | ||
You can see the limits set by running {{code|ulimit}} on the bash shell. | You can see the limits set by running {{code|ulimit}} on the bash shell. | ||
{{highlight|lang=terminal|code= | |||
# ulimit -n | |||
}} | |||
You can also see the per-user limits defined in {{code|/etc/security/limits.conf}}: | You can also see the per-user limits defined in {{code|/etc/security/limits.conf}}: | ||
{{highlight|lang=terminal|code= | |||
# cat /etc/security/limits.conf | |||
}} | |||
== See Also == | == See Also == | ||
* http://blog.thecodingmachine.com/content/solving-too-many-open-files-exception-red5-or-any-other-application | * http://blog.thecodingmachine.com/content/solving-too-many-open-files-exception-red5-or-any-other-application | ||
[[Category:Linux]]{{Navbox Linux}} | [[Category:Linux]]{{Navbox Linux}} | ||
Revision as of 03:50, 1 September 2019
Linux allows you to control how many opened file descriptor an user can have at any one time.
System-Wide Settings
To show the number of files opened on a system, run:
# cat /proc/sys/fs/file-nr
1536 0 793120
The fields are:
- Current number of opened files
- Number of free allocated file descriptors
- Maximum number of file descriptors for the whole system
You may change this value by:
# cat <new value> > /proc/sys/fs/file-nr
## Edit <code>/etc/sysctl.conf</code> so that there is a line
## fs.file-max = <new value>
Per-User Settings
You can see the limits set by running ulimit on the bash shell.
# ulimit -n
You can also see the per-user limits defined in /etc/security/limits.conf:
# cat /etc/security/limits.conf
See Also
- http://blog.thecodingmachine.com/content/solving-too-many-open-files-exception-red5-or-any-other-application