ulimit
shell builtinLinux/Unix
The ulimit command is one of the most frequently used commands in Linux/Unix-like operating systems. ulimit Get and set user limits for system resources
Quick Reference
Command Name:
ulimit
Category:
shell builtin
Platform:
Linux/Unix
Basic Usage:
ulimit [options] [arguments]
Common Use Cases
Syntax
ulimit [-HSabcdefiklmnpqrstuvxPT] [limit]
Options
Option | Description |
---|---|
-H |
Set the hard limit |
-S |
Set the soft limit |
-a |
Show all current limits |
-b |
The maximum socket buffer size |
-c |
The maximum size of core files created |
-d |
The maximum size of a process's data segment |
-e |
The maximum scheduling priority ("nice") |
-f |
The maximum size of files written by the shell and its children |
-i |
The maximum number of pending signals |
-k |
The maximum number of kqueues allocated |
-l |
The maximum size that may be locked into memory |
-m |
The maximum resident set size |
-n |
The maximum number of open file descriptors |
-p |
The pipe buffer size |
-q |
The maximum number of bytes in POSIX message queues |
-r |
The maximum real-time scheduling priority |
-s |
The maximum stack size |
-t |
The maximum amount of CPU time in seconds |
-u |
The maximum number of processes available to a single user |
-v |
The maximum amount of virtual memory available to the shell |
-x |
The maximum number of file locks |
-P |
The maximum number of pseudoterminals |
-T |
The maximum number of threads |
Examples
How to Use These Examples
The examples below show common ways to use the ulimit
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
Display all limits
ulimit -a
Check the maximum number of open files
ulimit -n
Set the maximum number of open files to 4096
ulimit -n 4096
Check the maximum file size a process can create
ulimit -f
Advanced Examples:
Set unlimited core file size
ulimit -c unlimited
Set both soft and hard limits for open files
ulimit -Hn 8192