[SUMMARY] How do I find which process owns a tcp port?

From: <P.Lister_at_cranfield.ac.uk>
Date: Thu, 10 Oct 96 11:02:42 +0100

Thanks to everyone who replied. The overwhelming majority said "get lsof", and
lsof -i tells me just what I need to know, with just one niggle - it seems
not to distinguish between source and destination address/port combinations,
so that it seems impossible to express "show me all the connections from host
x to port y". However, this is a very minor gripe, and it probably means I
haven't delved the details out of the man page. It would also be nice to have
extended host selection (i.e. everyone not on the local network), but I'm sure
that these can be built into lsof, or postprocessed.

FWIW, I did check the archive, but I couldn't find any query which looked like
what I needed. Hopefully, this email will be found by future enquirers before
it gets asked again.

The non lsof answers mentioned various weird and wonderful options to netstat.
Maybe there are some on other systems, but I certainly couldn't make them work
on alpha-osf. To all the people who suggested ways of munging netstat I say
thanks for the contribution, but have you heard about lsof? :-)

-- 
Peter Lister                             Email: p.lister_at_cranfield.ac.uk
Computer Centre, Cranfield University    Voice: +44 1234 754200 ext 2828
Cranfield, Bedfordshire MK43 0AL UK        Fax: +44 1234 751814
------------------------------------------------------------------------
GLENDOWER I can call spirits from the vasty deep.
HOTSPUR   Why, so can I, or so can any man;
          But will they come when you do call for them? (Henry IV, pt 1)
------------------------------------------------------------------------
Received on Thu Oct 10 1996 - 13:06:28 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:47 NZDT