Skip to content

Instantly share code, notes, and snippets.

@andrebaptista
Forked from bfgits/set ulimit
Created December 10, 2020 05:09
Show Gist options
  • Save andrebaptista/98eb7be9afd22da6b44bf4b2d6a69239 to your computer and use it in GitHub Desktop.
Save andrebaptista/98eb7be9afd22da6b44bf4b2d6a69239 to your computer and use it in GitHub Desktop.

Revisions

  1. @bfgits bfgits created this gist Apr 16, 2020.
    34 changes: 34 additions & 0 deletions set ulimit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # available limit
    user@ubuntu:~$ ulimit -n
    1024

    # To increase the available limit to say 65535
    user@ubuntu:~$ sudo vim /etc/sysctl.conf

    # add the following line to it
    fs.file-max = 65535

    sudo vim /etc/security/limits.conf

    # add following lines to it
    * soft nproc 65535
    * hard nproc 65535
    * soft nofile 65535
    * hard nofile 65535
    root soft nproc 65535
    root hard nproc 65535
    root soft nofile 65535
    root hard nofile 65535

    # edit the following file
    user@ubuntu:~$ sudo vim /etc/pam.d/common-session

    # add this line to it
    session required pam_limits.so

    # run this to refresh with new config
    user@ubuntu:~$ sudo sysctl -p

    # logout and login and try the following command
    user@ubuntu:~$ ulimit -n
    65535