ps and netstat

Jonathan I. Kamens jik at pit-manager.mit.edu
Mon Jul 23 22:09:59 AEST 1990


In article <1990Jul20.160919.16955 at ux1.cso.uiuc.edu> bob at uxa.cso.uiuc.edu (Bob Foertsch) writes:

   every open socket has some process running but there seems to be no way
   of getting the pid of a socket or the socket number of a pid. anyone
   have a 'tool' for this? ideas?

Check out the "ofiles" program, available in the comp.sources.unix
archives.  It can determine open file descriptors for specified
process ID's, or processes which currently have open file descriptors
on any specified device, or processes which have specific files open.
I don't think it can determine a PID given an open network socket,
especially since not all active network sockets are guaranteed to be
associated with a PID (for example, if a program using a socket
terminates prematurely, its socket may hang around for a while before
it goes away).

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710



More information about the Comp.unix.wizards mailing list