Note: this is an old post from my previous blog

Sometimes you may want to set limits on some of your system resources(Processes, Files)

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 limits

Apparently, 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:

This 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: 

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:

now change the following lines:

save 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:

and put the line:

update the system with::

3. List number of open files/allocated file handles

To check the number of files opened on your system, use:

You 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