The following table enumerates the available resource limits on a typical Linux system (alphabetically ordered by the ulimit option switch column):
Resource limit | ulimit option switch |
Default value | Unit |
max core file size | -c | unlimited | KB |
max data segment size | -d | unlimited | KB |
max scheduling priority (nice) | -e | 0 | Unscaled |
max file size | -f | unlimited | KB |
max (real-time) pending signals | -i | <varies> | Unscaled |
max locked memory | -l | <varies> | KB |
max memory size | -m | unlimited | KB |
max open files | -n | 1024 | Unscaled |
max pipe size | -p | 8 | 512-byte increments |
max POSIX message queues | -q | <varies> | Unscaled |
max real-time scheduling priority | -r | 0 | Unscaled |
max stack segment size | -s | 8192 | KB |
max CPU time | -t | unlimited | Seconds |
max user processes | -u | <varies> | Unscaled |
address space limit or max virtual memory | -v | unlimited | KB |
max file locks held | -x | unlimited | Unscaled |
There are a few points to note:
- At a glance, some of the resource limit meanings are quite obvious; several may not be. Most of them are not explained here, some of them will be touched upon in subsequent chapters.
- The second column is the option switch to pass to ulimit to display the current value for the particular resource limit in that row; for example, ulimit -s to print out the current value of the stack size resource limit (unit: KB).
- The third column is Default value. This, of course, could vary across Linux platforms. In particular, enterprise-class servers may tune their default values to be much higher than, say, an embedded Linux system. Also, quite often the default value is a calculation (based on, say, amount of RAM installed on the box); hence, the entry <varies> in some cases. Also, as mentioned earlier, unlimited does not mean infinite—it implies that no artificial upper limit has been enforced.
- Regarding the fourth column, Unit, the (bash(1)) man page (source: https://linux.die.net/man/1/bash) states the following:
[...] If limit is given, it is the new value of the specified resource (the -a option is display only). If no option is given, then -f is assumed. Values are in 1024-byte increments, except for -t, which is in seconds, -p, which is in units of 512-byte blocks, and -T, -b, -n, and -u, which are unscaled values. The return status is 0 unless an invalid option or argument is supplied, or an error occurs while setting a new limit. [...]
Also, unscaled implies it's just a number.
One can display all resource limits via the -a option switch; we leave it to you to try out the ulimit -a command.
Note that ulimit -a orders the resource limits alphabetically by option switch, just as we did in the table.
Also, it's really important to understand that these resource limits are with respect to a single process—the shell process (Bash)—that invoked the ulimit command.