To check limit open files

ulimit -n

To increase limit open files to 500000 on ubuntu, use command:

sudo sh -c "ulimit -n 500000 && exec su $LOGNAME"

Explain issues

ulimit is a shell built-in command like cd you can’t use like:

sudo cd /test/

similarly you can’t use

sudo ulimit -c

This is not a separate program. sudo looks for a binary to run, but there is no ulimit binary.

If you want to change your limit then you can define limits in limits.conf file. Those limits are defined in /etc/security/limits.conf or /etc/security/limits.d/. you can take help from this question


use shell like:

sudo sh -c "ulimit -c"
sudo bash -c "ulimit -c"
sudo bash -c ulimit 
sudo sh -c "ulimit -n"