]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/sockstat/sockstat.1
MFV r323530,r323533,r323534: 7431 ZFS Channel Programs, and followups
[FreeBSD/FreeBSD.git] / usr.bin / sockstat / sockstat.1
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$
29 .\"
30 .Dd September 12, 2017
31 .Dt SOCKSTAT 1
32 .Os
33 .Sh NAME
34 .Nm sockstat
35 .Nd list open sockets
36 .Sh SYNOPSIS
37 .Nm
38 .Op Fl 46cLlSsUuvw
39 .Op Fl j Ar jid
40 .Op Fl p Ar ports
41 .Op Fl P Ar protocols
42 .Sh DESCRIPTION
43 The
44 .Nm
45 command lists open Internet or
46 .Ux
47 domain sockets.
48 .Pp
49 The following options are available:
50 .Bl -tag -width Fl
51 .It Fl 4
52 Show
53 .Dv AF_INET
54 (IPv4) sockets.
55 .It Fl 6
56 Show
57 .Dv AF_INET6
58 (IPv6) sockets.
59 .It Fl c
60 Show connected sockets.
61 .It Fl j Ar jid
62 Show only sockets belonging to the specified jail ID.
63 .It Fl L
64 Only show Internet sockets if the local and foreign addresses are not
65 in the loopback network prefix
66 .Li 127.0.0.0/8 ,
67 or do not contain the IPv6 loopback address
68 .Li ::1 .
69 .It Fl l
70 Show listening sockets.
71 .It Fl p Ar ports
72 Only show Internet sockets if the local or foreign port number
73 is on the specified list.
74 The
75 .Ar ports
76 argument is a comma-separated list of port numbers and ranges
77 specified as first and last port separated by a dash.
78 .It Fl P Ar protocols
79 Only show sockets of the specified
80 .Ar protocols .
81 The
82 .Ar protocols
83 argument is a comma-separated list of protocol names,
84 as they are defined in
85 .Xr protocols 5 .
86 .It Fl S
87 Display the protocol stack, if applicable.
88 This is currently only implemented for TCP.
89 .It Fl s
90 Display the protocol state, if applicable.
91 This is currently only implemented for SCTP and TCP.
92 .It Fl U
93 Display the remote UDP encapsulation port number, if applicable.
94 This is currently only implemented for SCTP.
95 .It Fl u
96 Show
97 .Dv AF_LOCAL
98 .Pq Ux
99 sockets.
100 .It Fl v
101 Verbose mode.
102 .It Fl w
103 Use wider field size for displaying addresses.
104 .El
105 .Pp
106 If neither
107 .Fl 4 , 6
108 or
109 .Fl u
110 is specified,
111 .Nm
112 will list sockets in all three domains.
113 .Pp
114 If neither
115 .Fl c
116 or
117 .Fl l
118 is specified,
119 .Nm
120 will list both listening and connected sockets.
121 .Pp
122 The information listed for each
123 socket is:
124 .Bl -tag -width "FOREIGN ADDRESS"
125 .It Li USER
126 The user who owns the socket.
127 .It Li COMMAND
128 The command which holds the socket.
129 .It Li PID
130 The process ID of the command which holds the socket.
131 .It Li FD
132 The file descriptor number of the socket.
133 .It Li PROTO
134 The transport protocol associated with the socket for Internet
135 sockets, or the type of socket
136 .Pq stream, datagram, or seqpacket
137 for
138 .Ux
139 sockets.
140 .It Li LOCAL ADDRESS
141 For Internet sockets, this is the address the local end of the socket
142 is bound to (see
143 .Xr getsockname 2 ) .
144 For bound
145 .Ux
146 sockets, it is the socket's filename.
147 For other
148 .Ux
149 sockets, it is a right arrow followed by the endpoint's filename, or
150 .Dq Li ??
151 if the endpoint could not be determined.
152 .It Li FOREIGN ADDRESS
153 (Internet sockets only)
154 The address the foreign end of the socket is bound to (see
155 .Xr getpeername 2 ) .
156 .It Li ENCAPS
157 The remote UDP encapsulation port number if
158 .Fl U
159 is specified (only for SCTP).
160 .It Li PATH STATE
161 The path state if
162 .Fl s
163 is specified (only for SCTP).
164 .It Li CONN STATE
165 The connection state if
166 .Fl s
167 is specified (only for SCTP or TCP).
168 .It Li STACK
169 The protocol stack if
170 .Fl S
171 is specified (only for TCP).
172 .El
173 .Pp
174 If a socket is associated with more than one file descriptor,
175 it is shown multiple times.
176 If a socket is not associated with any file descriptor,
177 the first four columns have no meaning.
178 .Sh SEE ALSO
179 .Xr fstat 1 ,
180 .Xr netstat 1 ,
181 .Xr procstat 1 ,
182 .Xr inet 4 ,
183 .Xr inet6 4 ,
184 .Xr protocols 5
185 .Sh HISTORY
186 The
187 .Nm
188 command appeared in
189 .Fx 3.1 .
190 .Sh AUTHORS
191 The
192 .Nm
193 command and this manual page were written by
194 .An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .