Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Feb 2007 09:33:37 -0800
From:      Glenn Gillis <glenn@elaw.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Obtaining a pid or process owner from netstat?
Message-ID:  <45C22471.4040904@elaw.org>
In-Reply-To: <45C14130.1040502@gmail.com>
References:  <45C1381F.7010308@elaw.org> <45C14130.1040502@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
This is a cryptographically signed message in MIME format.

--------------ms070606050500080508000203
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Karol Kwiatkowski wrote:
> Glenn Gillis wrote:
>> If 'netstat -anp tcp' shows me an IP address and port with a process
>> listening on it, can anyone suggest a way to determine either the pid or
>> the owner of the process that is bound to that address?
>>
>> In other words:
>>
>> % netstat -anp tcp | grep LISTEN
>> tcp4       0      0  64.112.226.133.8091    *.*                   LISTEN
>> tcp4       0      0  64.112.226.133.8090    *.*                   LISTEN
>> tcp4       0      0  *.8021                 *.*                   LISTEN
>> tcp4       0      0  *.8080                 *.*                   LISTEN
>> tcp4       0      0  64.112.226.141.8080    *.*                   LISTEN
>> tcp4       0      0  64.112.226.133.13080   *.*                   LISTEN
>>
>> I'm interested in what is listening on 64.112.226.141.8080, mainly
>> because I need something else to listen there. I know it's a Zope
>> instance, but I can't tell *which* Zope instance (there are many on this
>> box.)
>>
>> NB: This is on a 4.11-RELEASE-p26 box.
> 
> Have a look at sockstat(1) and its options (like '-4' '-l' and '-p').
> 
> HTH,
> 
> Karol

Perfect, thanks!
-- 
Glenn

P.S. FWIW, the '-p' option does not appear to be valid under 4.11:

$ sockstat -p
Unknown option: p
Usage: sockstat [-46clu]

However, sockstat still gave me that I needed. Thx, G.

--------------ms070606050500080508000203
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIAC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JdUbs2FL2+dsE1A2/+33fyahHFTIocbrXJnMMooX
HSFDSjtEj70Zx4489UyjHiZ/jCAdTGpa6jVh5HtpIKZvTMfE92vpwEdVt0VyCsbUUBHJXZt6
mTmAiwGbvJRiYq/AuMg+CwCxGBNMaNKWfQAAAAAAAA==
--------------ms070606050500080508000203--



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?45C22471.4040904>