15b331014c68dfa238fa71cffe73d3f9425b2158
[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 .\" $DragonFly: src/usr.bin/sockstat/sockstat.1,v 1.3 2005/01/04 18:56:58 joerg Exp $
30 .\"
31 .Dd August 25, 2004
32 .Dt SOCKSTAT 1
33 .Os
34 .Sh NAME
35 .Nm sockstat
36 .Nd list open sockets
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl 46clu
40 .Op Fl p Ar ports
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 u
70 Show
71 .Dv AF_LOCAL
72 .Pq Ux
73 sockets.
74 .El
75 .Pp
76 If neither
77 .Fl 4 , 6
78 or
79 .Fl u
80 is specified,
81 .Nm
82 will list sockets in all three domains.
83 .Pp
84 If neither
85 .Fl c
86 or
87 .Fl l
88 is specified,
89 .Nm
90 will list both listening and connected sockets.
91 .Pp
92 The information listed for each
93 socket is:
94 .Bl -tag -width "FOREIGN ADDRESS"
95 .It Li USER
96 The user who owns the socket.
97 .It Li COMMAND
98 The command which holds the socket.
99 .It Li PID
100 The process ID of the command which holds the socket.
101 .It Li FD
102 The file descriptor number of the socket.
103 .It Li PROTO
104 The transport protocol associated with the socket for Internet
105 sockets, or the type of socket (stream or datagram) for
106 .Ux
107 sockets.
108 .It Li LOCAL ADDRESS
109 For Internet sockets, this is the address the local end of the socket
110 is bound to (see
111 .Xr getsockname 2 ) .
112 For bound
113 .Ux
114 sockets, it is the socket's filename.
115 For other
116 .Ux
117 sockets, it is a right arrow followed by the endpoint's filename, or
118 .Dq Li ??
119 if the endpoint could not be determined.
120 .It Li FOREIGN ADDRESS
121 (Internet sockets only)
122 The address the foreign end of the socket is bound to (see
123 .Xr getpeername 2 ) .
124 .El
125 .Pp
126 Note that TCP sockets in the
127 .Dv AF_INET
128 or
129 .Dv AF_INET6
130 domains that are not in one of the
131 .Dv LISTEN ,
132 .Dv SYN_SENT ,
133 or
134 .Dv ESTABLISHED
135 states may not be shown by
136 .Nm ;
137 use
138 .Xr netstat 1
139 to examine them instead.
140 .Sh SEE ALSO
141 .Xr fstat 1 ,
142 .Xr netstat 1 ,
143 .Xr inet 4 ,
144 .Xr inet6 4
145 .Sh HISTORY
146 The
147 .Nm
148 command appeared in
149 .Fx 3.1 .
150 .Sh AUTHORS
151 The
152 .Nm
153 command and this manual page were written by
154 .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .