Lsof Is Useless??
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? Philip |
I don't think that whoever wrote that tool is an idiot. I think that it does what it was designed to do very well.
If you really want just a count of the file descriptors open by each process, you can just spider the /proc directory and extract the data from there. To suggest someone is an idiot just because they didn't write a program to your needs seems a bit harsh. |
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 |
Files per process
Thanks for the script, it helps.
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. |
All times are GMT -5. The time now is 03:48 PM. |