Mastering ulimit: How to View and Adjust Linux Resource Limits
Learn how to use the Linux ulimit command to inspect and modify both hard and soft resource limits, understand the meaning of limit values such as hard, soft, and unlimited, and apply temporary or permanent changes via command line or the limits.conf file.
Overview of ulimit
The ulimit command controls the availability of system resources for a user or process. It can set or display both hard limits (which only root can change) and soft limits (which can be increased up to the hard limit).
Syntax and Options
Typical usage: ulimit [-HSTabcdefilmnpqrstuvx] [limit] -H : operate on the hard limit
-S : operate on the soft limit
If neither -H nor -S is specified, both limits are affected.
The limit argument can be a numeric value or one of the keywords hard, soft, or unlimited, representing the current hard limit, the current soft limit, or no restriction, respectively.
When the limit parameter is omitted, the current soft limit is printed unless -H is used.
Viewing Current Limits
To see the system‑wide maximum number of open files: cat /proc/sys/fs/file-max To view the per‑user limit (commonly 1024, but cloud providers often raise it to 65535):
ulimit -nModifying Limits
Temporary change (effective for the current shell only): ulimit -HSn 2048 Permanent change (applies to all users after login): vi /etc/security/limits.conf In limits.conf you can add entries such as:
* soft nofile 65535
* hard nofile 65535Illustrative Images
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
