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