2 .\" Copyright (c) 1999 Dag-Erling Coïdan Smørgrav
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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.
38 .Op Fl 46CciLlnqSsUuvw
45 command lists open Internet or
49 The following options are available:
60 Display the congestion control module, if applicable.
61 This is currently only implemented for TCP.
63 Show connected sockets.
68 Show only sockets belonging to the specified jail ID or name.
70 Only show Internet sockets if the local and foreign addresses are not
71 in the loopback network prefix
73 or do not contain the IPv6 loopback address
76 Show listening sockets.
78 Do not resolve numeric UIDs to user names.
80 Only show Internet sockets if the local or foreign port number
81 is on the specified list.
84 argument is a comma-separated list of port numbers and ranges
85 specified as first and last port separated by a dash.
87 Only show sockets of the specified
91 argument is a comma-separated list of protocol names,
92 as they are defined in
95 Quiet mode, do not print the header line.
97 Display the protocol stack, if applicable.
98 This is currently only implemented for TCP.
100 Display the protocol state, if applicable.
101 This is currently only implemented for SCTP and TCP.
103 Display the remote UDP encapsulation port number, if applicable.
104 This is currently only implemented for SCTP and TCP.
113 Use wider field size for displaying addresses.
122 will list sockets in all three domains.
130 will list both listening and connected sockets.
132 The information listed for each
134 .Bl -tag -width "FOREIGN ADDRESS"
136 The user who owns the socket.
138 The command which holds the socket.
140 The process ID of the command which holds the socket.
142 The file descriptor number of the socket.
144 The transport protocol associated with the socket for Internet
145 sockets, or the type of socket
146 .Pq stream, datagram, or seqpacket
151 For Internet sockets, this is the address the local end of the socket
153 .Xr getsockname 2 ) .
157 sockets, socket's filename is printed.
160 sockets, the field is empty.
161 .It Li FOREIGN ADDRESS
162 For Internet sockets, this is the address the foreign end of the socket
164 .Xr getpeername 2 ) .
168 sockets a left arrow followed by the peer list is printed.
171 sockets that went through
173 system call a right arrow followed by the peer is printed.
174 Peers are printed in square brackets as [PID FD].
178 is specified (only for TCP or UDP).
180 The remote UDP encapsulation port number if
182 is specified (only for SCTP or TCP).
186 is specified (only for SCTP).
188 The connection state if
190 is specified (only for SCTP or TCP).
192 The protocol stack if
194 is specified (only for TCP).
196 The congestion control if
198 is specified (only for TCP).
201 If a socket is associated with more than one file descriptor,
202 it is shown multiple times.
203 If a socket is not associated with any file descriptor,
204 the first four columns have no meaning.
206 Show information for IPv4 sockets listening on port 22 using protocol
208 .Bd -literal -offset indent
209 $ sockstat -4 -l -P tcp -p 22
212 Show information for sockets using either TCP or UDP, if neither, the local nor
213 the foreign addresses are in the loopback network:
214 .Bd -literal -offset indent
215 $ sockstat -L -P tcp,udp
218 Show TCP IPv6 sockets which are listening and connected (default):
219 .Bd -literal -offset indent
237 command and this manual page were written by
238 .An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .