Subject: Re: equivalent of sockstat?
To: ali (Anders Lindgren) <dat94ali@ludat.lth.se>
From: Geert Hendrickx <ghen@hmacs.cmi.ua.ac.be>
List: netbsd-help
Date: 12/23/2004 11:52:27
On Thu, Dec 23, 2004 at 11:24:05AM +0100, ali (Anders Lindgren) wrote:
> On Mon, 20 Dec 2004, Geert Hendrickx wrote:
> 
> > On FreeBSD, sockstat -4l lists all listening IPv4 sockets (with process,
> > user), sockstat -6c lists all connected IPv6 sockets, sockstat -ul lists
> > all listening UNIX domain sockets, etc.
> 
> It doesn't get you much closer than fstat, but lsof(8) has a plethora of
> options for querying about open files and makes it slightly easier to
> grep out listening sockets (they're marked with "(LISTEN)"). Lsof can
> be found in pkgsrc (sysutils/lsof). Not exactly what you wanted, but
> a very useful little program.
 
Yes, lsof seems nice.  It lists the process, the user, and other useful
information.  Open UDP sockets don't have "LISTEN" btw ('cause they're
not listening), but I could put up some shell scripts / aliases that do
the right grep'ing.  

Anyway, I find it a pity that this functionality (listing open sockets
with process+user) is not included in the base system.  I think it
should be.  It's the first thing I (want to) do on a fresh install (on
FreeBSD: sockstat -4l).  

GH

-- 
:wq