Linux ulimit Command
Linux ulimit
Command
The ulimit
command in Linux is used to set or display user process resource limits. It helps control the maximum usage of system resources per user.
ulimit Command Flags
Flag | Description |
---|---|
-n |
Shows or sets the maximum number of open file descriptors. |
-u |
Displays or sets the maximum number of user processes. |
-f |
Limits the maximum file size that can be created by the shell. |
-a |
Displays all current limits. |
-H |
Shows or sets the hard limit (maximum value a user can set). |
-S |
Shows or sets the soft limit (current value a user can set). |
Usage Examples
Check the current file descriptor limit:
$ ulimit -n
Set a new file descriptor limit temporarily (valid for current session only):
$ ulimit -n 100000
Check all resource limits:
$ ulimit -a
Set both soft and hard limits for file descriptors:
$ ulimit -Sn 50000
$ ulimit -Hn 100000
To make changes persistent, modify the /etc/security/limits.conf
or use system configuration files.