]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - usr.bin/sockstat/sockstat.1
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.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 9, 2009
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 46cLlu
39 .Op Fl p Ar ports
40 .Op Fl P Ar protocols
41 .Sh DESCRIPTION
42 The
43 .Nm
44 command lists open Internet or
45 .Ux
46 domain sockets.
47 .Pp
48 The following options are available:
49 .Bl -tag -width Fl
50 .It Fl 4
51 Show
52 .Dv AF_INET
53 (IPv4) sockets.
54 .It Fl 6
55 Show
56 .Dv AF_INET6
57 (IPv6) sockets.
58 .It Fl c
59 Show connected sockets.
60 .It Fl L
61 Only show Internet sockets if the local or foreign addresses are not
62 in the loopback network prefix
63 .Li 127.0.0.0/8 ,
64 or do not contain the IPv6 loopback address
65 .Li ::1 .
66 .It Fl l
67 Show listening sockets.
68 .It Fl p Ar ports
69 Only show Internet sockets if either the local or foreign port number
70 is on the specified list.
71 The
72 .Ar ports
73 argument is a comma-separated list of port numbers and ranges
74 specified as first and last port separated by a dash.
75 .It Fl P Ar protocols
76 Only show sockets of the specified
77 .Ar protocols .
78 The
79 .Ar protocols
80 argument is a comma-separated list of protocol names,
81 as they are defined in
82 .Xr protocols 5 .
83 .It Fl u
84 Show
85 .Dv AF_LOCAL
86 .Pq Ux
87 sockets.
88 .El
89 .Pp
90 If neither
91 .Fl 4 , 6
92 or
93 .Fl u
94 is specified,
95 .Nm
96 will list sockets in all three domains.
97 .Pp
98 If neither
99 .Fl c
100 or
101 .Fl l
102 is specified,
103 .Nm
104 will list both listening and connected sockets.
105 .Pp
106 The information listed for each
107 socket is:
108 .Bl -tag -width "FOREIGN ADDRESS"
109 .It Li USER
110 The user who owns the socket.
111 .It Li COMMAND
112 The command which holds the socket.
113 .It Li PID
114 The process ID of the command which holds the socket.
115 .It Li FD
116 The file descriptor number of the socket.
117 .It Li PROTO
118 The transport protocol associated with the socket for Internet
119 sockets, or the type of socket (stream or datagram) for
120 .Ux
121 sockets.
122 .It Li LOCAL ADDRESS
123 For Internet sockets, this is the address the local end of the socket
124 is bound to (see
125 .Xr getsockname 2 ) .
126 For bound
127 .Ux
128 sockets, it is the socket's filename.
129 For other
130 .Ux
131 sockets, it is a right arrow followed by the endpoint's filename, or
132 .Dq Li ??
133 if the endpoint could not be determined.
134 .It Li FOREIGN ADDRESS
135 (Internet sockets only)
136 The address the foreign end of the socket is bound to (see
137 .Xr getpeername 2 ) .
138 .El
139 .Pp
140 Note that TCP sockets in the
141 .Dv AF_INET
142 or
143 .Dv AF_INET6
144 domains that are not in one of the
145 .Dv LISTEN , SYN_SENT ,
146 or
147 .Dv ESTABLISHED
148 states may not be shown by
149 .Nm ;
150 use
151 .Xr netstat 1
152 to examine them instead.
153 .Sh SEE ALSO
154 .Xr fstat 1 ,
155 .Xr netstat 1 ,
156 .Xr procstat 1 ,
157 .Xr inet 4 ,
158 .Xr inet6 4 ,
159 .Xr protocols 5
160 .Sh HISTORY
161 The
162 .Nm
163 command appeared in
164 .Fx 3.1 .
165 .Sh AUTHORS
166 The
167 .Nm
168 command and this manual page were written by
169 .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .