SUMMARY: PID <--> socket

From: Chris Raiskin (craiskin@verity.com)
Date: Thu Jan 27 2000 - 13:18:52 CST


Unanimous response:
         use lsof

Availability:
         source:
                 ftp://vic.cc.purdue.edu/pub/tools/unix/lsof
         precompiled:
                 http://sunfreeware.com

For the task described below, the -i option does the trick.

Thank you ALL!!!

<<<ORIGINAL MESSAGE>>>

>
> > Is there a way to determine which PID has opened a specific socket?
> >
> > netstat -a -f inet
> >
> > thishost.ftp thathost.3754 7881 0 8760 0 CLOSE_WAIT
> > thishost.64496 thathost.3758 8760 0 8760 0 ESTABLISHED
> >
> > Then, ps -ef | grep ftpd would show these ftpd processes.
> > Is there a way to tell which PID services the above socket?
> >
> > ftp 4958 140 0 Nov 12 ? 0:19 in.ftpd -a
> > ftp 4947 140 0 Nov 12 ? 0:04 in.ftpd -a
> > ftp 5375 140 0 Dec 15 ? 0:01 in.ftpd -a
> > ftp 6357 140 0 Dec 16 ? 0:30 in.ftpd -a



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:02 CDT