netstat options

Nathan Kinkade nkinkade at fastmail.fm
Thu Sep 18 08:15:10 PDT 2003


On Thu, Sep 18, 2003 at 02:36:58PM +0100, Matthew Seaman wrote:
> On Thu, Sep 18, 2003 at 03:24:29PM +0200, dick hoogendijk wrote:
> > > At 01:01 PM 9/18/2003 +0200, you wrote:
> 
> > > >Active Internet connections (servers and established)
> > > >Proto Recv-Q Send-Q Local Address    Foreign Address   State
> > > >tcp   0   0 0.0.0.0:32768      0.0.0.0:*               LISTEN
> > > >tcp   0   0 0.0.0.0:32769      0.0.0.0:*               LISTEN
> > > >tcp   0   0 0.0.0.0:993        0.0.0.0:*               LISTEN
> > > >tcp   0   0 0.0.0.0:515        0.0.0.0:*               LISTEN
> > > >tcp   0   0 0.0.0.0:995        0.0.0.0:*               LISTEN
> > > >tcp   0   0 0.0.0.0:37         0.0.0.0:*               LISTEN
> 
> > What I wanted to know is the equivalent for the LINUX "netstat -atun"
> > which gives the output above (on the LINUX server). I want to test my
> > FreeBSD machine the same way but "netstat -atun" gives me an output I
> > don't want (on fbsd).
> 
> If all you want are the tcp sockets, then
> 
>     % netstat -an -p tcp
> 
> otherwise: 
> 
>     % netstat -an -f inet
> 
> will give you all of the network sockets, but not the unix domain
> sockets.
> 
> 	Cheers,
> 
> 	Matthew

If you are simply interested in tcp ports with listening sockets
you might try using sockstat(1).

$ sockstat -l4

... should show you all listening IPv4 sockets.

Nathan
-- 
gpg --keyserver pgp.mit.edu --recv-keys D8527E49
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030918/1a0e9a16/attachment.bin


More information about the freebsd-questions mailing list