Okay, how the heck DO I increase the number of files on my system

Ubuntu Support Template

Ubuntu Version:
Example: 24.04.3 LTS

Desktop Environment (if applicable):
KDE Plasma but that isn’t relevant.

Problem Description:
I need to raise the number of open file descriptors on my system, but can find no authoritative information on how to do so. I should mention here that this is a home laptop computer not involved in any network other than my home wifi. I am the admin.

The first consensus recommendation from a simple Google search is editing the appropriate parameters in /etc/security/limits.conf .

But when I open this file I see only commented out lines explaining how to edit this file; it has no active content, and yet somehow my limits are 1024 for both hard and soft. If I add the following two lines

*       soft    nofile 2048
*       hard    nofile 2048

and log out and in, the limit remains 1024.

Other, more advanced sites, such as this one on superuser point me at editing files in /etc/systemd which seems like it’s the right track except this post dates from 2017, and files mentioned do not exist on my system.

So my question is, what is the recommended way to increase the max open files on my system (Ubuntu 24.04.3 LTS).

My underlying question is why is this kept such a freaking mystery.

Screenshots or Error Messages:

What I’ve Tried:
see above

Did an AI assisted search. It pointed me at the aforementioned /etc/security/limits.conf and also at /etc/sysctl.conf, which, again is a file full of commented out parameters, none of which have anything to do with file limits.

You can do it for a single shell session with ulimit command:

View current soft limits:

ulimit -a

View current hard limits:

ulimit -H -a

Set a new soft limit for number of open files:

ulimit -n NEW_LIMIT

replacing NEW_LIMIT with the new soft limit (mine defaults to 1024 and I need to raise it to 4096 for some tasks, which is still below the hard limit on my system)

Run ulimit --help for more info

1 Like

Okay, and where are the hard limits stored? I can raise mine to 2048. That is apparently the hard limit. What if I want to go higher?

I answered your question over on ask.

@stevecoh1

Two things:

Firstly, please revise the title of your topic. Titles should be descriptive but not casual. Think about discoverability, think about volunteer users who are looking to help.

The other thing is that we discourage posting the same question on multiple platforms.

It dilutes community efforts to help you and often leaves one topic open while another is closed, making it harder for users to find the solution.

For reference:

If the solution provided by @dsmythies solves the issue, then please mark it as such in both locations.

Thanks

3 Likes