Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!newsfeed.internetmci.com!news.ac.net!news.cais.net!nntp.uio.no!nntp.uib.no!nntp-bergen.UNINETT.no!nntp-trd.UNINETT.no!not-for-mail From: sthaug@nethelp.no (Steinar Haug) Newsgroups: comp.security.unix,comp.unix.admin,comp.unix.bsd.freebsd.misc Subject: Re: How to associate a socket w/ PID? (BSD solution) Date: 30 Jul 1996 09:42:39 GMT Organization: Nethelp Consulting, Trondheim, Norway Lines: 19 Message-ID: <4tklef$di1@verdi.nethelp.no> References: <4tk4mh$qpl@hermes.jersey.net> <4tkjg6$st@charm.il.ft.hse.nl> NNTP-Posting-Host: trane.uninett.no In-reply-to: robert@il.ft.hse.nl's message of 30 Jul 1996 11:09:26 +0200 Xref: euryale.cc.adfa.oz.au comp.security.unix:26620 comp.unix.admin:45479 comp.unix.bsd.freebsd.misc:24664 [robert] | >How do you find out which process is associated with a network | >connection other than recognizing the port? | | charm.il.ft.hse.nl:/pub/perl/nstat.pl | It's a perl-program I wrote a while back for my FreeBSD machine, but I | just checked and it also seems to work on BSDI. | | It combines the outputs of fstat(8) and netstat(8), and produces something | like this: | -- | PID User Command Pro Local Address Foreign Address State | 29545 nobody httpd tcp 145.85.127.2.80 194.90.103.192.144 ESTABLISHED There is already a wonderful tool available to do this and much more - it's called lsof. Available from your nearest FTP archie, check with archie. Steinar Haug, Nethelp consulting, sthaug@nethelp.no