But other times, you may want to do the just the opposite - disable those limits or change them to higher limits like I needed to do few days ago.
1. Check what are the limitsApparently, RedHat set the default max number of open files for users to 1024 and and not long ago, this was change to 4096.
For some applications/users this is very low and can cause you a lot of problems.
You can check what is the current limit with ulimit using bash shell:
ulimit -HnThis will show you the hard limit of maximum number of files for your user. you can use -S to check the soft limit.
tcsh: using tcsh you can can check this limit with limit descriptors
if you wish to check the max Open file descriptors for the process your user/application running, use the following command:
cat /proc/[Process ID]/limits
To check what is the system limit for number of files descriptors use the following command:
2. Change the limit
lets start by changing the limit for the user mario:
vi /etc/security/limits.confnow change the following lines:
mario soft nofile 4096 mario hard nofile 20480save the file and verify the result by using ulimit like we used it in section 1.
If you want to set maximum number of processes use nproc instead of nofile
If you want to set this setting to all users use * instead of specify user name
Now lets change the limit for the entire system:
vi /etc/sysctl.confand put the line:
fs.file-max = 200500
update the system with::
3. List number of open files/allocated file handles
To check the number of files opened on your system, use:
lsof | wc -lYou can also check the allocated file descriptors by using:
the first field is the number of total allocated files descriptors.
second field is unused file descriptors
and the third field is the maximum file descriptors that can be used