Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Sep 1998 23:53:14 +0200
From:      Ollivier Robert <roberto@keltia.freenix.fr>
To:        "FreeBSD-Net (FreeBSD.Org) List" <freebsd-net@FreeBSD.ORG>
Subject:   Re: How to find which application is using a given UDP port
Message-ID:  <19980907235314.A25006@keltia.freenix.fr>
In-Reply-To: =?iso-8859-1?Q?=3Cxzppvd8ut72=2Efsf=40hrotti=2Eifi=2Euio=2Eno=3E=3B_from?= =?iso-8859-1?Q?_Dag-Erling_Coidan_Sm=F8rgrav__on_Mon=2C_Sep_07=2C_1998_a?= =?iso-8859-1?Q?t_12:13:05PM_%2B0200?=
References:  <Pine.BSF.4.02A.9809070222480.6323-100000@shell6.ba.best.com> <xzppvd8ut72.fsf@hrotti.ifi.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
According to Dag-Erling Coidan Smørgrav :
> It won't tell you *which* app holds the port. fstat(1) will tell you
> which processes have open TCP or UDP sockets, but not which port. The
> trick is to use 'fstat' and 'netstat -Aan' and compare addresses:

Better to use lsof (in ports/sysutils/lsof) which does that automatically.

lsof -i ucp
COMMAND   PID   USER   FD   TYPE     DEVICE SIZE/OFF INODE NAME
syslogd   107   root    4u  inet 0xf5830f60      0t0   UDP *:syslog 
named     116   root    4u  inet 0xf5830f00      0t0   UDP *:1024 
named     116   root   20u  inet 0xf5830ea0      0t0   UDP keltia.freenix.fr:domain 
named     116   root   22u  inet 0xf5830e40      0t0   UDP localhost:domain 
portmap   124 daemon    3u  inet 0xf5830de0      0t0   UDP *:sunrpc 
inetd     148   root   10u  inet 0xf5830c60      0t0   UDP *:biff 
inetd     148   root   11u  inet 0xf5830c00      0t0   UDP *:ntalk 
inetd     148   root   17u  inet 0xf5830ba0      0t0   UDP *:echo 
inetd     148   root   18u  inet 0xf5830b40      0t0   UDP *:discard 
inetd     148   root   19u  inet 0xf5830ae0      0t0   UDP *:chargen 
inetd     148   root   20u  inet 0xf5830a80      0t0   UDP *:daytime 
inetd     148   root   21u  inet 0xf5830a20      0t0   UDP *:time 
inetd     148   root   25u  inet 0xf58309c0      0t0   UDP *:amanda 
ntpd      878   root    4u  inet 0xf5830cc0      0t0   UDP *:ntp 
ntpd      878   root    5u  inet 0xf5830d20      0t0   UDP keltia.freenix.fr:ntp 
ntpd      878   root    6u  inet 0xf5830d80      0t0   UDP localhost:ntp 
actived 11699   news    4u  inet 0xf5830960      0t0   UDP localhost:1119 

-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr
FreeBSD keltia.freenix.fr 3.0-CURRENT #63: Tue Sep  1 00:50:29 CEST 1998


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980907235314.A25006>