Linux – how to increase “open files” limit for process from 1024 to 10240

bashlinux

I have a process (java program)that require many temporary files. There is limit set that we cannot have more than 1024 open descriptors. How do I increase "open files" limit for process from 1024 to 10240
I can reduce the value.. not increase it.
The following works.

ulimit -n 899 

The following does not work

ulimit -n 1025

Best Answer

You will need root access to increase it. If you're using Ubuntu (also works for other distros): http://ubuntuforums.org/archive/index.php/t-521287.html

If you're using bash, the command is 'ulimit -n'. To change the limit permanently edit /etc/security/limits.conf (your distro may use a different location).

For a list of all options, use -a:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited