Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a question that it might seem too simple. Nevertheless, here it goes:
My linux machine is rendered useless because my apps complain: to many files open. I use red hat 9.0
Using lsof or any othe tool, how can I get summary vision, not the list of each open file, of the amount of files that each process has open? I need something like:
Name #files
Proc1 99
Proc2 2000
Etc.
Is it possible to get a picture like that from vanilla lsof? Don't we agree that whever wrote that utility is an idiot? Am I the only engineer who sees this issue in this manner?
And if all you really want is what you mentioned above, a list of pids and the number of file descriptors they have in use, try this:
Code:
#!/bin/bash
PIDS=`echo /proc/[0-9]* | sed 's/\/proc\///g' | sed 's/ /\n/g' | sort -n`
for i in $PIDS
do if [ -d "/proc/$i/" ]
then echo -n "$i: "
ls /proc/$i/fd/ | wc -w 2>/dev/null
fi
done
I just whipped this up on the fly, so there may be a bug or two, but I'm sure you get the idea.
The question is: how do I include the command name? Also, many processes are created by others, in my case the Asterisk PBX spawns many subprocesses. Is there a way to do a grouping on the first 5 letters of the command name, instead of the process number?
I know my questions are too simple for a real linux expert. I appreciate your help. These are basic debugging techniques, and the world deserves to have access to them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.