Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I do an

lsof | grep user | wc -l

I get a number returned in the 25,000 range.

If I check

ulimit -a user

nofiles is set at 1024.

Can someone help me to understand the number of open files setting better? Clearly it's not the case, but I thought a hard nofiles of 1024 meant a user can't have more than 1024 open files.

share|improve this question

The file limit returned by ulimit is the number of files that can be opened by a single process (ulimit -n to only see number of descriptors). The value returned is the RLIMIT_NOFILE (or man getrlimit), described in man ulimit. This small application will output the same value (1024):

#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>

int main(){
    struct rlimit info;
    getrlimit(RLIMIT_NOFILE, &info);
    printf("%d\n", info.rlim_cur);
    return 0;
share|improve this answer
Interesting. Thank you for busting out the source, it makes it much easier to understand how it plays out. – HayekSplosives Apr 8 '13 at 17:03
Glad you found it helpful. Please accept the answer if you feel it is good enough :) – Kristian Evensen Apr 8 '13 at 19:34

You are probably counting a lot of duplicate files. Try

lsof -u <user> | grep "/" |sort -k9 -u | wc

which should filter out some of the non-file descriptors and the duplicate file entries. I stole this answer from an identical questions on Serverfault.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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