Friday, January 20, 2012

Where Are My Open Files Go? lsof++

So where are my IO handles (open files) are being spend... here a oneliner First get the PID and ram everything of lsof thru the parser....

[wev@wad03 logs]$ /usr/sbin/lsof -p 21336 | perl -MData::Dumper -ne 'BEGIN { my %x=();} {@s=split /\s+/;$x{$s[4]}++;} END { print Dumper(\%x); }'
$VAR1 = {
          'IPv6' => 3,
          'unix' => 1,
          'DIR' => 2,
          'TYPE' => 1,
          'CHR' => 4,
          '0000' => 1,
          'REG' => 463,
          'sock' => 1
        };
[wev@wad03 logs]$