LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Open desc. count by app and faster method to discover used count than lsof? (https://www.linuxquestions.org/questions/linux-general-1/open-desc-count-by-app-and-faster-method-to-discover-used-count-than-lsof-4175700899/)

postcd 09-21-2021 03:59 AM

Open desc. count by app and faster method to discover used count than lsof?
 
Hello,

i am wondering how to quickly discover currently used desc. more quickly than using lsof which is too slow.

cat /proc/sys/fs/file-max
...quintillion high number here...

ulimit -Sn
1024

ulimit -Hn
90000

grep nofile /etc/security/limits.conf
# - nofile - max number of 0pen file descript0rs
* hard nofile 900000

$ cat /proc/sys/fs/file-nr
36480 0 quintillion_high_value_here

$ sudo ls -l /proc/*/fd|sort -h|grep -v total|wc -l
18970

lsof|wc -l
1591966

and correct location to modify the limit is likely that limits.conf file on Arch? and btw any clever command or script to output top descript0r usage apps with the count of desc. used by these? I have found only this one. Thank you

frankbell 09-21-2021 09:57 PM

I doubt seriously that you will find a faster method than lsof.

Also, please surround any terminal output with "code" tags which become available when you click the "Advanced" button beneath the compose/edit post window. It makes terminal output much easier to read.

TB0ne 09-22-2021 08:19 AM

Quote:

Originally Posted by postcd (Post 6285797)
Hello,
i am wondering how to quickly discover currently used desc. more quickly than using lsof which is too slow.

First question would be WHY is it 'too slow', followed by what are you actually trying to accomplish with this??
Quote:

Code:

cat /proc/sys/fs/file-max
...quintillion high number here...

ulimit -Sn
1024

ulimit -Hn
90000

grep nofile /etc/security/limits.conf
#        - nofile - max number of 0pen file descript0rs
*                hard        nofile                900000

$ cat /proc/sys/fs/file-nr
36480 0 quintillion_high_value_here

$ sudo ls -l /proc/*/fd|sort -h|grep -v total|wc -l
18970

lsof|wc -l
1591966

and correct location to modify the limit is likely that limits.conf file on Arch?
Did you try putting "how to modify open file descriptors on arch linux" into Google?? Reading the first hit?
https://wiki.archlinux.org/title/Limits.conf
Quote:

and btw any clever command or script to output top descript0r usage apps with the count of desc. used by these? I have found only this one. Thank you
That's a good one...you can also write your own. But again, you don't say what you're trying to accomplish/do, or what version/distro of Linux (only can assume arch) you're using. Since you (again) don't clearly state what you're trying to accomplish or provide details, the best you can get is a generic answer.


All times are GMT -5. The time now is 10:24 AM.