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