Soft limit β Limits the amount of resource that the process may consume. The ulimit -S command is used to view or set the soft limit. Any user can modify the soft limits.
Hard limit β It is the upper bound value to which the soft limit may be adjusted. The ulimit -H command is used to view or set the hard limit. Only the Super User can modify the hard limits.
ulimit provides a way for users to manage and control process-specific resource limits, ensuring a balance between user needs and system stability. Soft limits allow users to fine-tune resource usage, while hard limits serve as the ultimate safeguard set by the system administrator to prevent resource abuse.
ulimit is a shell built-in command, which means it is executed directly by the shell itself and not an external executable. It operates on a per-process basis, meaning the limits set by ulimit only affect the current shell session and its child processes.
( soft limits <= hard limits)
Few of the resources that can be configured using ulimit are:
Maximum Core Dump Size Limit (-c). Set to ‘unlimitedβ to allow core dumps of any size. It is in blocks. (512 bytes per block)
Maximum Data Segment Size (-d). Set to βunlimitedβ to allow programs to use as much data memory as needed. Units are in Kilobytes (KB).
Maximum File Size (-f). Set to βunlimitedβ to allow files of any size. Measured in blocks (512 Bytes per block)
Maximum Locked-in-Memory Address Space (-l). The amount of memory a process can lock in physical RAM to prevent swapping. Set to βunlimitedβ by default to allow locking all available memory. It is measured in KB.
Maximum Physical Memory Size (-m). Set to βunlimitedβ to allow processes to use all available memory. Measured in KB.
Maximum Number of Open File Descriptors( -n). By default, set to a high value (1024). It is counted in number of files.
Maximum Resident Set Size (-q). Set to βunlimitedβ by default to allow processes to use all available RAM. It is measured in KB.
Maximum Stack Size (-s). By default it is set to high value (8192KB). It is measured in KB.
Maximum CPU Time Allowed (-t). Total CPU time a process can consume. Set to βunlimitedβ by default to use CPU time without restrictions. It is counted in seconds.
Maximum Number of User Processes (-u). Set to high value by default (2048) .It is counted in number of processes.
Maximum Virtual Memory Size (-v). Set to βunlimitedβ by default. Counted in KB.
Maximum File Locking Count(-x). Set to high value . Counted in number of locks.
Maximum Number of Threads(-T). Set to a system-defined valye based on system configuration. It is counted in number of threads.
You can know the resources available in /etc/security/limits.conf
To Set Soft limits:
Check for current value by using anyone of the command in following way,
ulimit -t
Change it by,
ulimit -t 15
Check it by again,
ulimit -t
Use the below command in a similar way for the Hard limits.
ulimit -H -t
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An Article by: Yashwanth Naidu Tikkisetty
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
