Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Open files per process via lsof

by grinder (Bishop)
on May 05, 2004 at 13:33 UTC ( #350764=snippet: print w/ replies, xml ) Need Help??

Description:

lsof is a tool to LiSt Open Files. It's a handy tool to have when you need to find out why you can't dismount a device, or see if a process is about to exceed its maximum number of allowed file handles. (Here's the project homepage).

But the output is verbose. If you just want the number of open files, and the process name and pid, the following one-liner performs a nice summary.

lsof | perl -lane '$x{"$F[0]:$F[1]"}++;
END { print "$x{$_}\t$_" for sort {$x{$a}<=>$x{$b}} keys %x}'
Comment on Open files per process via lsof
Download Code

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://350764]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (13)
As of 2014-12-19 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (90 votes), past polls