= Setting ULimit on Red Hat =
**Summary**: How to set uLimits on Red Hat. \\
**Date**: Around 2014 \\
**Refactor**: 29 March 2025: Checked links and formatting. \\
{{tag>redhat linux}}
Most shells like Bash provide control over various resources like the maximum allowable number of open file descriptors or the maximum number of processes available to a user.
= Working with Limits =
To see all shell limits, run:
[sjoerd@redhatbox limits.d]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 709150
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
This will show the soft limits by default. You can see the hard limits like this:
[sjoerd@redhatbox limits.d]$ ulimit -Ha
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 709150
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 709150
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
The hard limit is the ceiling for the soft limit. The soft limit is what is actually enforced for a session or process. This allows the administrator (or user) to set the hard limit to the maximum usage they wish to allow. Other users and processes can then use the soft limit to self-limit their resource usage to even lower levels if they so desire.
In the command output you see between () options to view a specific limit:
[sjoerd@redhatbox limits.d]$ ulimit -n
1024
[sjoerd@redhatbox limits.d]$ ulimit -Sn
1024
[sjoerd@redhatbox limits.d]$ ulimit -Hn
4096
As you can see, these also show the soft limit by default.
= Setting Limits =
There are two ways to set the limits on Red Hat. You can set them in the limits.conf file ({{{/etc/security/limits.conf}}}) or create separate files per user in the limits.d directory:
[sjoerd@redhatbox limits.d]$ pwd
/etc/security/limits.d
[sjoerd@redhatbox limits.d]$ ll
total 8
-rw-r--r--. 1 root root 191 Oct 7 2013 90-nproc.conf
-rw-r--r--. 1 root root 127 Sep 4 11:40 99-appuser-limits.conf
[sjoerd@redhatbox limits.d]$ cat 99-appuser-limits.conf
appuser soft nproc 50000
appuser hard nproc 709150
appuser soft nofile 10000
appuser hard nofile 10000
= Resources =
See [[redhat65management]] to set these limits for an oracle user during installation through kickstart.