xref: /dragonfly/usr.bin/sockstat/sockstat.1 (revision 9a92bb4c)
1.\"-
2.\" Copyright (c) 1999 Dag-Erling Co�dan Sm�rgrav
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer
10.\"    in this position and unchanged.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. The name of the author may not be used to endorse or promote products
15.\"    derived from this software without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.\" $FreeBSD: src/usr.bin/sockstat/sockstat.1,v 1.19 2004/08/25 16:36:17 roam Exp $
29.\" $DragonFly: src/usr.bin/sockstat/sockstat.1,v 1.3 2005/01/04 18:56:58 joerg Exp $
30.\"
31.Dd August 25, 2004
32.Dt SOCKSTAT 1
33.Os
34.Sh NAME
35.Nm sockstat
36.Nd list open sockets
37.Sh SYNOPSIS
38.Nm
39.Op Fl 46clu
40.Op Fl p Ar ports
41.Sh DESCRIPTION
42The
43.Nm
44command lists open Internet or
45.Ux
46domain sockets.
47.Pp
48The following options are available:
49.Bl -tag -width Fl
50.It Fl 4
51Show
52.Dv AF_INET
53(IPv4) sockets.
54.It Fl 6
55Show
56.Dv AF_INET6
57(IPv6) sockets.
58.It Fl c
59Show connected sockets.
60.It Fl l
61Show listening sockets.
62.It Fl p Ar ports
63Only show Internet sockets if either the local or foreign port number
64is on the specified list.
65The
66.Ar ports
67argument is a comma-separated list of port numbers and ranges
68specified as first and last port separated by a dash.
69.It Fl u
70Show
71.Dv AF_LOCAL
72.Pq Ux
73sockets.
74.El
75.Pp
76If neither
77.Fl 4 , 6
78or
79.Fl u
80is specified,
81.Nm
82will list sockets in all three domains.
83.Pp
84If neither
85.Fl c
86or
87.Fl l
88is specified,
89.Nm
90will list both listening and connected sockets.
91.Pp
92The information listed for each
93socket is:
94.Bl -tag -width "FOREIGN ADDRESS"
95.It Li USER
96The user who owns the socket.
97.It Li COMMAND
98The command which holds the socket.
99.It Li PID
100The process ID of the command which holds the socket.
101.It Li FD
102The file descriptor number of the socket.
103.It Li PROTO
104The transport protocol associated with the socket for Internet
105sockets, or the type of socket (stream or datagram) for
106.Ux
107sockets.
108.It Li LOCAL ADDRESS
109For Internet sockets, this is the address the local end of the socket
110is bound to (see
111.Xr getsockname 2 ) .
112For bound
113.Ux
114sockets, it is the socket's filename.
115For other
116.Ux
117sockets, it is a right arrow followed by the endpoint's filename, or
118.Dq Li ??
119if the endpoint could not be determined.
120.It Li FOREIGN ADDRESS
121(Internet sockets only)
122The address the foreign end of the socket is bound to (see
123.Xr getpeername 2 ) .
124.El
125.Pp
126Note that TCP sockets in the
127.Dv AF_INET
128or
129.Dv AF_INET6
130domains that are not in one of the
131.Dv LISTEN ,
132.Dv SYN_SENT ,
133or
134.Dv ESTABLISHED
135states may not be shown by
136.Nm ;
137use
138.Xr netstat 1
139to examine them instead.
140.Sh SEE ALSO
141.Xr fstat 1 ,
142.Xr netstat 1 ,
143.Xr inet 4 ,
144.Xr inet6 4
145.Sh HISTORY
146The
147.Nm
148command appeared in
149.Fx 3.1 .
150.Sh AUTHORS
151The
152.Nm
153command and this manual page were written by
154.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
155