lsof?
Steve Smythe
ssmythe at channelpoint.com
Wed Jul 25 10:37:52 CDT 2001
Not to contribute anything useful, but since there's a "lsof"
command, don't you think there should be more useful commands
like "rotfl" and "rtfm"? :-)
Steve
> -----Original Message-----
> From: Robert L. Harris [mailto:Robert.L.Harris at rdlg.net]
> Sent: Wednesday, July 25, 2001 9:32 AM
> To: Keary Suska
> Cc: Pikes-Peak Perl Mongers
> Subject: Re: lsof?
>
>
>
>
> Yeah, I'm currently doing an open so I can parse the input
> one line at a time with a while statement (just like how it
> works). I was hoping there might be a module I don't know about
> that'll provide similar functionality without having to call
> an external program.
>
> Robert
>
> Thus spake Keary Suska (aksuska at webflyer.com):
>
> > I am not familiar with "lsof", but you can use backticks:
> >
> > @array = ` lsof -i | grep <port>`;
> >
> > Or open a pipe-from:
> >
> > open PIPE, "lsof -i | grep <port> |";
> >
> > Beware of security problems when using these--don't pass
> any tainted data.
> > You may also want to install a signal handler for SIGPIPE, which is
> > triggered when you have a broken pipe. Otherwise, you
> really don't have any
> > idea if your pipe attempt failed.
> >
> > Keary Suska
> > Esoteritech, Inc.
> > "Leveraging Open Source for a better Internet"
> >
> > > From: "Robert L. Harris" <Robert.L.Harris at rdlg.net>
> > > Date: Tue, 24 Jul 2001 15:28:24 -0600
> > > To: Pikes-Peak Perl Mongers
> <pikes-peak-pm-list at happyfunball.pm.org>
> > > Subject: lsof?
> > >
> > >
> > >
> > > OK,
> > > I've gotten a great response from you guys. Definitely
> blows away the
> > > 2 other perl lists I'm on, and the answers are nice,
> clean and consice,
> > > even my spelling is pretty rotten.
> > >
> > > I have another one for you. In the same script I need to
> do something
> > > like "lsof -i | grep <port>" to find out what process is
> using a port,
> > > or possibly an IP. I can't find an "lsof" module, so I'm
> hoping someone
> > > may know something similar.
> > >
> > > Thoughts?
> > > Robert
> > >
> > >
> > > :wq!
> > >
> --------------------------------------------------------------
> -------------
> > > Robert L. Harris | Micros~1 :
> > > Senior System Engineer | For when quality, reliability
> > > at RnD Consulting | and security just aren't
> > > \_ that important!
> > > DISCLAIMER:
> > > These are MY OPINIONS ALONE. I speak for no-one else.
> > > FYI:
> > > perl -e 'print
> $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
> > >
> > >
>
>
>
> :wq!
> --------------------------------------------------------------
> -------------
> Robert L. Harris | Micros~1 :
> Senior System Engineer | For when quality, reliability
> at RnD Consulting | and security just aren't
> \_ that important!
> DISCLAIMER:
> These are MY OPINIONS ALONE. I speak for no-one else.
> FYI:
> perl -e 'print
> $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
>
More information about the Pikes-peak-pm
mailing list