Let’s Learn How To Change The Open File Limit In Linux

Today, lacking anything better to do, we’re going to learn how to change the open file limit in Linux. Why would you want to do this? Buggered if I know! But, I’m gonna tell you how! (You’re welcome!)

Actually, you could be working with many files and want to increase the number of files that can be open at one time. You might also want the opposite, as a way of limiting system resources.

Basically, in Linux, anything that can use resources has some sort of limitation. For example, there’s a limit to how many arguments that can be passed in a single command or for a new process. You’re unlikely to bump into that limit as a regular desktop Linux user, but that limit is there.

Heck, if you want to learn more about that, click this. I’m not entirely sure how to change that value, but it might actually be in some notes somewhere. Someone’s gotta know how.

Again, you’re very unlikely to run into problems as regular ol’ desktop Linux user. Realistically, you’re unlikely to have to change the open file limit in Linux. However, today is the day I tell you how! Why? ‘Cause I ain’t scared – and it’s not my computer that you’re mucking about in!

I should also mention, more to remind you gentlefolk, that everything in Linux is a file. Everything… So, you’d be surprised how many files you have open at times. Even then, you still probably don’t have too much of a need to change the open file limit.

Change The Open File Limit:

Like many articles, this one requires an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, now is a good time to tell you that there’s a hard limit and a soft limit. The hard limit can only be changed by root and the soft limit can be altered dynamically by the process.

You can learn those limits. To find the hard limit, use this command:

And, to find the soft limit, use this command:

Those commands will output the value of your hard and soft limits, respectively. 

You can obviously change those limits, else this wouldn’t be an article. To change the open file limit, you just add a new value as an additional argument. It’s something like:

And, again for the soft limit:

For example, you might increase the hard limit with a command like so:

If  you want to make them permanent changes, you can do that. It’s a little different for the hard limit and the soft limit. So, to make them permanent we need to use nano to do some file editing:

And add this line:

If you want to change the soft limit, it’s a little different. It’s just:

If it’s not obvious, replace the username with your username (and no brackets, of course). Then, of course, you’ll need to save the file. To do that, just press CTRL + X, then Y, and then ENTER and that’ll save the file properly.

You shouldn’t need to reboot. The changes should be immediate and you can run the above commands to verify this. If the changes somehow didn’t take effect, reboot and  you should be good to go.


I’ve never really needed to change the open file limit as a desktop Linux user, but you might have a reason to do so. If that’s the case, it makes sense to have this information handy, and now you do.

It’s yet another article in a long, long list of articles – a list that’s growing steadily! I have yet to miss a single publication date, though I feel compelled to do so – as it’d take the pressure off knowing that I no longer have a “perfect” record.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe to Newsletter!
Get notified when new articles are published!
We promise to never share your email!

Author: KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Leave a Reply

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

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.