If I want to check if I got to the max of the nproc value should I do:

ps -ef | wc -l


ps -efL | wc -l

Does nproc in limits.conf refers to number of processes or number of threads?


On Linux it refers to the number of threads. From setrlimit(2) (which is the system call used to set the limits):


The maximum number of processes (or, more precisely on Linux, threads) that can be created for the real user ID of the calling process. Upon encountering this limit, fork(2) fails with the error EAGAIN. This limit is not enforced for processes that have either the CAP_SYS_ADMIN or the CAP_SYS_RESOURCE capability.

So ps -efL | wc -l would be more appropriate, however the limits in limits.conf apply per login session (see limits.conf(5) for details).

| improve this answer | |
  • So the nproc limit does not limit the root? – Liron Cohen Nov 9 '16 at 11:58
  • No, it doesn't limit root. – Stephen Kitt Nov 9 '16 at 12:23
  • another question - how come there are lines in limit.conf of limits for root if it does not limit root? – Liron Cohen Nov 9 '16 at 15:06
  • 2
    Other limits do apply to root, for example core. It's nproc which doesn't apply to root, not all the limits. – Stephen Kitt Nov 9 '16 at 15:33

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.