Linux Ulimit Command Tutorial with Examples To Increase Open File Limit

Linux kernel provides some configuration about system related limits and maximums. These are like maximum file handler count, maximum file locks, maximum process count etc. These limits are used to stay in safe area and do not bottleneck system performance. But sometimes these limits should be decreased or increased. ulimit is used to change these limits and maximums.

List All Limits

There are different types of limits and maximum values used in Linux  configuration. We can list all existing limits with -a option like below.

$ ulimit -a
List All Limits
List All Limits

We can see that some information about limits are provided.

  • Limit name provided which is useful the limit topic
  • Limit metrics are provided what kind of metrics used
  • Limit option provided to set or list limit value
  • Current limit values are provided

List Specific Limit

We have seen in previous example that we can access specific limit configuration with its option. This will only list given limit. In this example we will list  file locks with -x .

$ ulimit -x
List Specific Limit
List Specific Limit


limits.conf file is used store limit related configuration. It can be accessed from /etc/security/limits.conf . There s also /etc/security/limits.d directory which can hold multiple configurations files.   For more detailed information about limits.conf read following tutorial.

limits.conf File To Limit Users, Process In Linux With Examples

Set Limit

We can set limits to the given metric by providing the limit value after the limit option. In this example we will set core file size unlimited with the following command.

$ ulimit -c unlimited

We  can check new value by listing the limit which is explained previous steps.

Maximum Number Of Open Files Descriptors

Maximum number of open files descriptors are used to limit concurrent open file count. A lot of files open concurrently will hurt disk and system performance. But in some systems like SIEM higher values may be more suitable.In this example we set maximum number of open files descriptors to 10000 . Changing these ulimit values will require root privileges

$ sudo ulimit -n 10000

Maximum Number Of Process For User

Maximum number of process for user will limit process count owner by a single user. Default value is 7900 . In this example we will decrease this value to the 500.

$ sudo ulimit -n 500


LEARN MORE  Linux Bash Default Environment Variables

2 thoughts on “Linux Ulimit Command Tutorial with Examples To Increase Open File Limit”

  1. Nowadays ulimit and /etc/security/limits.conf has become pretty useless with the exception of processes you start in your shell.

    On ulimit I describe why this is the case and how to solve limit issues in Systemd, Upstart or start-stop-daemon based init scripts.


Leave a Comment