Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!bu.edu!purdue!mentor.cc.purdue.edu!noose.ecn.purdue.edu!samsung!sol.ctr.columbia.edu!emory!att!princeton!phoenix.Princeton.EDU!tty!keyboard!subbarao!kartik From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Newsgroups: comp.unix.questions Subject: Re: identifying processes that own sockets Message-ID: Date: 23 Apr 91 21:00:19 GMT References: <167@sleepy.UUCP> Sender: news@idunno.Princeton.EDU Reply-To: subbarao@phoenix (Kartik Subbarao) Lines: 45 In article <167@sleepy.UUCP> allyn@sleepy.UUCP (Mark Allyn) writes: >The netstat command shows the prototype, local address, and foreign >address for each active internet connection. > >I would like to be able to identify the process that own the socket for >a particular internet connection. > >Using the netstat -A gives the address of the protocol family for >a socket. Is there any way (using iostat, pstat, or anything else) that >I can correlate a particular socket to a particular process id?? The ofiles command can help you here. You can correlate a protocol's port to a given pid by saying: ofiles . example: % ofiles tcp.513 lists all the in.rlogind's on the system, and % ofiles udp.512 lists all the comsat processes. You can see ALL processes on tcp ports by saying: % ofiles tcp. Hope this helps. -Kartik -- internet# rm `df | tail +2 | awk '{ printf "%s/quotas\n",$6}'` subbarao@phoenix.Princeton.EDU -| Internet kartik@silvertone.Princeton.EDU (NeXT mail) SUBBARAO@PUCC.BITNET - Bitnet