Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save raymadrona/76daa8f4c33ff8b6517e49d7b0ab6c0c to your computer and use it in GitHub Desktop.
Save raymadrona/76daa8f4c33ff8b6517e49d7b0ab6c0c to your computer and use it in GitHub Desktop.
How to increase ulimit in Linux

How to increase ulimit in Linux:

  • Step 1 (ulimit): open the sysctl.conf and add this line fs.file-max = 65536

      vi /etc/sysctl.conf   
    

    add following at end of file in above file:

      fs.file-max = 65536
    

save and exit.

  • Step 2 (ulimit):

      vi /etc/security/limits.conf
    

    Add following 4 lines in above file

      *  soft nproc  65535
      *  hard nproc  65535
      *  soft nofile 65535
      *  hard nofile 65535
    

save and exit check max open file ulimit

Example command to verify and sample output:

[root@localhost# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 127358
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
**OPEN FILES                      (-N) 65535**
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Increase max user processes in Linux

  • Step 1 (user processes):

      vi /etc/security/limits.conf
    

add following in above file

	*  soft nproc  65535
	*  hard nproc  65535
	*  soft nofile 65535
	*  hard nofile 65535
  • Step 2 (user processes): vi /etc/security/limits.d/90-nproc.conf

add following in above file

	*  soft nproc  65535
	*  hard nproc  65535
	*  soft nofile 65535
	*  hard nofile 65535

save and exit check the user max processes ulimit

[root@localhost# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 127358
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65535
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
**MAX USER PROCESSES              (-U) 65535**
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment