1999-04-15 14:40:43 +01:00
|
|
|
|
.\"-
|
|
|
|
|
.\" Copyright (c) 1999 Dag-Erling Co<43>dan Sm<53>rgrav
|
|
|
|
|
.\" All rights reserved.
|
|
|
|
|
.\"
|
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
|
.\" are met:
|
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer
|
|
|
|
|
.\" in this position and unchanged.
|
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
|
.\" 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
.\" derived from this software without specific prior written permission.
|
|
|
|
|
.\"
|
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
.\"
|
1999-08-28 02:08:13 +01:00
|
|
|
|
.\" $FreeBSD$
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.\"
|
2001-08-07 20:59:52 +01:00
|
|
|
|
.Dd August 7, 2001
|
1999-09-06 14:14:24 +01:00
|
|
|
|
.Dt SOCKSTAT 1
|
2001-07-10 15:16:33 +01:00
|
|
|
|
.Os
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.Sh NAME
|
|
|
|
|
.Nm sockstat
|
2000-10-07 15:11:43 +01:00
|
|
|
|
.Nd list open sockets
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
|
.Nm
|
2001-03-06 13:48:38 +00:00
|
|
|
|
.Op Fl 46clu
|
2001-08-07 20:59:52 +01:00
|
|
|
|
.Op Fl p Ar ports
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
|
The
|
|
|
|
|
.Nm
|
2001-08-10 11:43:45 +01:00
|
|
|
|
command lists open Internet or
|
|
|
|
|
.Ux
|
|
|
|
|
domain sockets.
|
2000-10-07 15:11:43 +01:00
|
|
|
|
.Pp
|
|
|
|
|
The following options are available:
|
|
|
|
|
.Bl -tag -width Fl
|
|
|
|
|
.It Fl 4
|
2001-08-10 11:43:45 +01:00
|
|
|
|
Show
|
|
|
|
|
.Dv AF_INET
|
|
|
|
|
(IPv4) sockets.
|
2000-10-07 15:11:43 +01:00
|
|
|
|
.It Fl 6
|
2001-08-10 11:43:45 +01:00
|
|
|
|
Show
|
|
|
|
|
.Dv AF_INET6
|
|
|
|
|
(IPv6) sockets.
|
2001-03-06 13:48:38 +00:00
|
|
|
|
.It Fl c
|
|
|
|
|
Show connected sockets.
|
|
|
|
|
.It Fl l
|
|
|
|
|
Show listening sockets.
|
2001-08-07 20:59:52 +01:00
|
|
|
|
.It Fl p Ar ports
|
|
|
|
|
Only show Internet sockets if either the local or foreign port number
|
|
|
|
|
is on the specified list.
|
|
|
|
|
The
|
|
|
|
|
.Ar ports
|
|
|
|
|
argument is a comma-separated list of port numbers and ranges
|
|
|
|
|
specified as first and last port separated by a dash.
|
2000-10-07 15:11:43 +01:00
|
|
|
|
.It Fl u
|
2001-08-10 11:43:45 +01:00
|
|
|
|
Show
|
|
|
|
|
.Dv AF_LOCAL
|
|
|
|
|
.Pq Ux
|
|
|
|
|
sockets.
|
2000-10-07 15:11:43 +01:00
|
|
|
|
.El
|
|
|
|
|
.Pp
|
2001-03-06 13:48:38 +00:00
|
|
|
|
If neither
|
2001-08-10 11:43:45 +01:00
|
|
|
|
.Fl 4 , 6
|
2001-03-06 13:48:38 +00:00
|
|
|
|
or
|
|
|
|
|
.Fl u
|
|
|
|
|
is specified,
|
2000-10-07 15:11:43 +01:00
|
|
|
|
.Nm
|
2001-03-06 13:48:38 +00:00
|
|
|
|
will list sockets in all three domains.
|
|
|
|
|
.Pp
|
|
|
|
|
If neither
|
|
|
|
|
.Fl c
|
|
|
|
|
or
|
|
|
|
|
.Fl l
|
|
|
|
|
is specified,
|
|
|
|
|
.Nm
|
|
|
|
|
will list both listening and connected sockets.
|
2000-10-07 15:11:43 +01:00
|
|
|
|
.Pp
|
2000-03-01 12:20:22 +00:00
|
|
|
|
The information listed for each
|
1999-04-15 14:40:43 +01:00
|
|
|
|
socket is:
|
1999-07-06 20:12:31 +01:00
|
|
|
|
.Bl -tag -width "FOREIGN ADDRESS"
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.It Li USER
|
|
|
|
|
The user who owns the socket.
|
|
|
|
|
.It Li COMMAND
|
|
|
|
|
The command which holds the socket.
|
|
|
|
|
.It Li PID
|
|
|
|
|
The process ID of the command which holds the socket.
|
|
|
|
|
.It Li FD
|
|
|
|
|
The file descriptor number of the socket.
|
|
|
|
|
.It Li PROTO
|
2000-10-07 15:11:43 +01:00
|
|
|
|
The transport protocol associated with the socket for Internet
|
2001-08-10 11:43:45 +01:00
|
|
|
|
sockets, or the type of socket (stream or datagram) for
|
|
|
|
|
.Ux
|
|
|
|
|
sockets.
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.It Li LOCAL ADDRESS
|
2002-07-31 13:32:03 +01:00
|
|
|
|
For Internet sockets, this is the address the local end of the socket
|
|
|
|
|
is bound to (see
|
2001-01-16 09:39:23 +00:00
|
|
|
|
.Xr getsockname 2 ) .
|
2002-11-26 17:33:37 +00:00
|
|
|
|
For bound
|
|
|
|
|
.Ux
|
2002-07-31 13:32:03 +01:00
|
|
|
|
sockets, it is the socket's filename.
|
2002-11-26 17:33:37 +00:00
|
|
|
|
For other
|
|
|
|
|
.Ux
|
2002-07-31 13:32:03 +01:00
|
|
|
|
sockets, it is a right arrow followed by the endpoint's filename, or
|
|
|
|
|
.Dq Li ??
|
|
|
|
|
if the endpoint could not be determined.
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.It Li FOREIGN ADDRESS
|
2000-10-07 15:11:43 +01:00
|
|
|
|
(Internet sockets only)
|
1999-04-15 14:40:43 +01:00
|
|
|
|
The address the foreign end of the socket is bound to (see
|
2001-01-16 09:39:23 +00:00
|
|
|
|
.Xr getpeername 2 ) .
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.El
|
|
|
|
|
.Sh SEE ALSO
|
|
|
|
|
.Xr fstat 1 ,
|
1999-07-06 20:12:31 +01:00
|
|
|
|
.Xr netstat 1 ,
|
2000-02-26 02:56:16 +00:00
|
|
|
|
.Xr inet 4 ,
|
2000-03-26 15:56:52 +01:00
|
|
|
|
.Xr inet6 4
|
1999-04-15 14:40:43 +01:00
|
|
|
|
.Sh HISTORY
|
|
|
|
|
The
|
|
|
|
|
.Nm
|
|
|
|
|
command appeared in
|
|
|
|
|
.Fx 3.1 .
|
|
|
|
|
.Sh AUTHORS
|
|
|
|
|
The
|
|
|
|
|
.Nm
|
|
|
|
|
command and this manual page were written by
|
2001-08-13 17:33:00 +01:00
|
|
|
|
.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
|