dang: how to display the process ass'd with an active port

James Wu admin at znode.org
Wed Feb 18 15:32:26 PST 2004


> From: "Goodleaf, John M" <jgoodlea at fhcrc.org>
> Subject: dang: how to display the process ass'd with an active port
> 
> Under 4.9, how can I tell which process is associated with a port? I've
> noticed a few oddball ports open on a machine, and I'd like to know which
> process did that. Seems straightforward and yet I don't know the answer.

As root, do
# sockstat -4l

You should see which processes and ports are listening, such as:
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
garble   xpilots    1587  3  udp4   *:15345               *:*
root     sendmail   449   4  tcp4   127.0.0.1:25          *:*
root     sshd       443   3  tcp4   *:22                  *:*


More information about the freebsd-newbies mailing list