Who has port X open?
Ron Peterson
ron.peterson at yellowbank.com
Wed Apr 11 23:46:33 EDT 2001
Ron Peterson wrote:
>
> John Chambers wrote:
> >
> > Not to change the subject or anything, but in the midst of
> > the deep philosophical debate, does anyone happen to know:
> >
> > How can I tell what program has port X opoen?
>
> I think maybe the -i option to 'lsof' is what you're looking for?
e.g. from 'lsof -i :80'
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
httpsd 1695 root 16u IPv4 10836 TCP *:www (LISTEN)
httpsd 14026 root 16u IPv4 10836 TCP *:www (LISTEN)
httpsd 14027 root 16u IPv4 10836 TCP *:www (LISTEN)
httpsd 14028 root 16u IPv4 10836 TCP *:www (LISTEN)
httpsd 14029 root 16u IPv4 10836 TCP *:www (LISTEN)
httpsd 14030 root 16u IPv4 10836 TCP *:www (LISTEN)
httpsd 14031 root 16u IPv4 10836 TCP *:www (LISTEN)
netscape- 15665 rpeterso 26u IPv4 527744 TCP
pagoda.mtholyoke.edu:39615->images.slashdot.org:www (CLOSE_WAIT)
...etc.
I should mention that because lsof is so tightly coupled to the
underlying OS, if you've rolled your own kernel, you may need to roll
your own lsof. From the README:
********************************************************************
| The latest release of lsof is always available via anonymous ftp |
| from vic.cc.purdue.edu. Look in pub/tools/unix/lsof. |
********************************************************************
-Ron-
GPG and other info at: http://www.yellowbank.com/
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list