identifying processes that own sockets

Kartik Subbarao subbarao at phoenix.Princeton.EDU
Wed Apr 24 07:00:19 AEST 1991


In article <167 at sleepy.UUCP> allyn at 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 <protcols>.<protnum>

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 at phoenix.Princeton.EDU -| Internet
kartik at silvertone.Princeton.EDU (NeXT mail)  
SUBBARAO at PUCC.BITNET			          - Bitnet



More information about the Comp.unix.questions mailing list