]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - usr.bin/sockstat/sockstat.1
MFC r335921:
[FreeBSD/stable/10.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 July 3, 2018
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 46cLlsu
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 jail
62 Show only sockets belonging to the specified jail ID or name.
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 state, if applicable.
88 This is currently only implemented for SCTP and TCP.
89 .It Fl u
90 Show
91 .Dv AF_LOCAL
92 .Pq Ux
93 sockets.
94 .El
95 .Pp
96 If neither
97 .Fl 4 , 6
98 or
99 .Fl u
100 is specified,
101 .Nm
102 will list sockets in all three domains.
103 .Pp
104 If neither
105 .Fl c
106 or
107 .Fl l
108 is specified,
109 .Nm
110 will list both listening and connected sockets.
111 .Pp
112 The information listed for each
113 socket is:
114 .Bl -tag -width "FOREIGN ADDRESS"
115 .It Li USER
116 The user who owns the socket.
117 .It Li COMMAND
118 The command which holds the socket.
119 .It Li PID
120 The process ID of the command which holds the socket.
121 .It Li FD
122 The file descriptor number of the socket.
123 .It Li PROTO
124 The transport protocol associated with the socket for Internet
125 sockets, or the type of socket
126 .Pq stream, datagram, or seqpacket
127 for
128 .Ux
129 sockets.
130 .It Li LOCAL ADDRESS
131 For Internet sockets, this is the address the local end of the socket
132 is bound to (see
133 .Xr getsockname 2 ) .
134 For bound
135 .Ux
136 sockets, it is the socket's filename.
137 For other
138 .Ux
139 sockets, it is a right arrow followed by the endpoint's filename, or
140 .Dq Li ??
141 if the endpoint could not be determined.
142 .It Li FOREIGN ADDRESS
143 (Internet sockets only)
144 The address the foreign end of the socket is bound to (see
145 .Xr getpeername 2 ) .
146 .El
147 .Pp
148 If a socket is associated with more than one file descriptor,
149 it is shown multiple times.
150 If a socket is not associated with any file descriptor,
151 the first four columns have no meaning.
152 .Sh SEE ALSO
153 .Xr fstat 1 ,
154 .Xr netstat 1 ,
155 .Xr procstat 1 ,
156 .Xr inet 4 ,
157 .Xr inet6 4 ,
158 .Xr protocols 5
159 .Sh HISTORY
160 The
161 .Nm
162 command appeared in
163 .Fx 3.1 .
164 .Sh AUTHORS
165 The
166 .Nm
167 command and this manual page were written by
168 .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .