Ulimit

Soft and Hard

The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit: an unprivileged process may set only its soft limit to a value in the range from 0 up to the hard limit, and (irreversibly) lower its hard limit. A privileged process (under Linux: one with the CAP_SYS_RESOURCE capability in the initial user namespace) may make arbitrary changes to either limit value.

Commands

CommandsDescription
-tcpu time (seconds)
-ffile size (blocks)
-ddata seg size (kbytes)
-sstack size (kbytes)
-ccore file size (blocks)
-mresident set size (kbytes)
-uprocesses
-nfile descriptors
-llocked-in-memory size (kbytes)
-vaddress space (kbytes)
-xfile locks
-ipending signals
-qbytes in POSIX msg queues
-emax nice
-rmax rt priority
-N 15kA

Usage

Show all limits

To list all limites, just run ulimit -a

$ ulimit -a

Or if you want to see only one specific limit, you can add the parameter without any value ulimit -[parameter]

$ ulimit -n

In a session

To set the limits for a session you only need to run ulimit with the parameter which matches the limit you want to change

$ ulimit -n 2048

Global

For chaning it globally (system wide) you have to place your changes into /etc/security/limits.conf or /etc/security/limits.d/newifle The prefered place is to store it beneath limits.d as no update on packages will overwrite it Lets assume, you want to change the open file limit, just add the following line

* soft nofile 2048

If you want to have it in hard state, just replace soft with hard in the config. Now the device needs to be rebooted to apply it system wide.