Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    lsof vs. cat /proc/sys/fs/file-nr vs. ulimit

    ulimit seems to be per process maximum, correct? I see my process running out of file descriptors and I know increasing the ulimit will fix it. Before I fix it though, I am trying to find a program that shows the number of files I have open. I know inside proc, I can do "ls -l /proc/21195/fd/ | wc -l" which says I hava 1023 open...hmmmm, we changed the ulimit from 1024 to 4096 and 1023 is really close to 1024(maybe it closed one file since running out).....maybe the limit is smaller than I think. Is there a different command to see the file descriptor limit for a process(as I understand it there are overrides from the system), but I checked some file "vi /etc/security/limits.conf" and saw it was 4096 for my user in there too. any ideas on this one?

    1. how to check the maximum files for my pid?
    2. how to list the current number of files open? (I assume my command above is correct for that on ls | wc -l?)


  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    3rd rock from sun - Often seen near moon
    1.If I'm not wrong,you can't set max. fd limit per process basis , only per user basis.
    2.Yes,ls /proc/pid/fd should work along with command likes lsof,fuser etc
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    FOSS India Award winning ext3fs Undelete tool Online Linux Terminal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts