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