root@Andromeda:/# ulimit -n -S
root@Andromeda:/# ulimit -n -H
root@Andromeda:/# ulimit -n -S 4096
root@Andromeda:/# echo $?

Failure to set soft limit above the hard one makes sense.

What perhaps does not make sense is why the exit code of this attempt is 0.


It seems that putting -H or -S at the end causes it to report, not set. And therefore no error. The number at the end seems to be ignored. As far as I can tell this should be a usage error, but not a limits error.

| improve this answer | |
  • thanks; and what is the syntax for setting explicitly either the soft of the hard limits via ulimit? – pkaramol Apr 20 '19 at 8:51
  • The right syntax for setting requires reversing -S and -n: root@Andromeda:/# ulimit -S -n 1024 root@Andromeda:/# ulimit -n -S 1024 – pkaramol Apr 20 '19 at 8:56
  • 1
    More properly: Per the utility conventions in the Single Unix Specification, and despite none of these options for ulimit being standardized, the correct syntax is for arguments to command-line options, the value of the limit in this case, to immediately follow the options themselves, such as -n in this case, without any other intervening command-line arguments. – JdeBP Apr 21 '19 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.