xref: /freebsd/usr.bin/sockstat/sockstat.1 (revision 25044bbcfbcffd99ee4beaa679c01cb10bc9f991)
158278509SDag-Erling Smørgrav.\"-
2fb2ad9d3SUlrich Spörlein.\" Copyright (c) 1999 Dag-Erling Coïdan Smørgrav
358278509SDag-Erling Smørgrav.\" All rights reserved.
458278509SDag-Erling Smørgrav.\"
558278509SDag-Erling Smørgrav.\" Redistribution and use in source and binary forms, with or without
658278509SDag-Erling Smørgrav.\" modification, are permitted provided that the following conditions
758278509SDag-Erling Smørgrav.\" are met:
858278509SDag-Erling Smørgrav.\" 1. Redistributions of source code must retain the above copyright
958278509SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer
1058278509SDag-Erling Smørgrav.\"    in this position and unchanged.
1158278509SDag-Erling Smørgrav.\" 2. Redistributions in binary form must reproduce the above copyright
1258278509SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer in the
1358278509SDag-Erling Smørgrav.\"    documentation and/or other materials provided with the distribution.
1458278509SDag-Erling Smørgrav.\" 3. The name of the author may not be used to endorse or promote products
1558278509SDag-Erling Smørgrav.\"    derived from this software without specific prior written permission.
1658278509SDag-Erling Smørgrav.\"
1758278509SDag-Erling Smørgrav.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1858278509SDag-Erling Smørgrav.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1958278509SDag-Erling Smørgrav.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2058278509SDag-Erling Smørgrav.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2158278509SDag-Erling Smørgrav.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2258278509SDag-Erling Smørgrav.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2358278509SDag-Erling Smørgrav.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2458278509SDag-Erling Smørgrav.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2558278509SDag-Erling Smørgrav.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2658278509SDag-Erling Smørgrav.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2758278509SDag-Erling Smørgrav.\"
28c3aac50fSPeter Wemm.\" $FreeBSD$
2958278509SDag-Erling Smørgrav.\"
30*25044bbcSMichael Tuexen.Dd April 7, 2015
315ff829fdSSheldon Hearn.Dt SOCKSTAT 1
3262500372SRuslan Ermilov.Os
3358278509SDag-Erling Smørgrav.Sh NAME
3458278509SDag-Erling Smørgrav.Nm sockstat
35ac1070c6SDag-Erling Smørgrav.Nd list open sockets
3658278509SDag-Erling Smørgrav.Sh SYNOPSIS
3758278509SDag-Erling Smørgrav.Nm
389b6ca892SBruce M Simpson.Op Fl 46cLlu
3900feaafdSAndrew Thompson.Op Fl j Ar jid
4003f28475SDag-Erling Smørgrav.Op Fl p Ar ports
411f3d67aaSGiorgos Keramidas.Op Fl P Ar protocols
4258278509SDag-Erling Smørgrav.Sh DESCRIPTION
4358278509SDag-Erling SmørgravThe
4458278509SDag-Erling Smørgrav.Nm
453ce0d6e8SRuslan Ermilovcommand lists open Internet or
463ce0d6e8SRuslan Ermilov.Ux
473ce0d6e8SRuslan Ermilovdomain sockets.
48ac1070c6SDag-Erling Smørgrav.Pp
49ac1070c6SDag-Erling SmørgravThe following options are available:
50ac1070c6SDag-Erling Smørgrav.Bl -tag -width Fl
51ac1070c6SDag-Erling Smørgrav.It Fl 4
523ce0d6e8SRuslan ErmilovShow
533ce0d6e8SRuslan Ermilov.Dv AF_INET
543ce0d6e8SRuslan Ermilov(IPv4) sockets.
55ac1070c6SDag-Erling Smørgrav.It Fl 6
563ce0d6e8SRuslan ErmilovShow
573ce0d6e8SRuslan Ermilov.Dv AF_INET6
583ce0d6e8SRuslan Ermilov(IPv6) sockets.
59a0581bbcSDag-Erling Smørgrav.It Fl c
60a0581bbcSDag-Erling SmørgravShow connected sockets.
6100feaafdSAndrew Thompson.It Fl j Ar jid
6200feaafdSAndrew ThompsonShow only sockets belonging to the specified jail ID.
639b6ca892SBruce M Simpson.It Fl L
649b6ca892SBruce M SimpsonOnly show Internet sockets if the local or foreign addresses are not
659b6ca892SBruce M Simpsonin the loopback network prefix
669b6ca892SBruce M Simpson.Li 127.0.0.0/8 ,
679b6ca892SBruce M Simpsonor do not contain the IPv6 loopback address
689b6ca892SBruce M Simpson.Li ::1 .
69a0581bbcSDag-Erling Smørgrav.It Fl l
70a0581bbcSDag-Erling SmørgravShow listening sockets.
7103f28475SDag-Erling Smørgrav.It Fl p Ar ports
72*25044bbcSMichael TuexenOnly show Internet sockets if the local or foreign port number
7303f28475SDag-Erling Smørgravis on the specified list.
7403f28475SDag-Erling SmørgravThe
7503f28475SDag-Erling Smørgrav.Ar ports
7603f28475SDag-Erling Smørgravargument is a comma-separated list of port numbers and ranges
7703f28475SDag-Erling Smørgravspecified as first and last port separated by a dash.
781f3d67aaSGiorgos Keramidas.It Fl P Ar protocols
791f3d67aaSGiorgos KeramidasOnly show sockets of the specified
801f3d67aaSGiorgos Keramidas.Ar protocols .
811f3d67aaSGiorgos KeramidasThe
821f3d67aaSGiorgos Keramidas.Ar protocols
831f3d67aaSGiorgos Keramidasargument is a comma-separated list of protocol names,
841f3d67aaSGiorgos Keramidasas they are defined in
851f3d67aaSGiorgos Keramidas.Xr protocols 5 .
86ac1070c6SDag-Erling Smørgrav.It Fl u
873ce0d6e8SRuslan ErmilovShow
883ce0d6e8SRuslan Ermilov.Dv AF_LOCAL
893ce0d6e8SRuslan Ermilov.Pq Ux
903ce0d6e8SRuslan Ermilovsockets.
91ac1070c6SDag-Erling Smørgrav.El
92ac1070c6SDag-Erling Smørgrav.Pp
93a0581bbcSDag-Erling SmørgravIf neither
943ce0d6e8SRuslan Ermilov.Fl 4 , 6
95a0581bbcSDag-Erling Smørgravor
96a0581bbcSDag-Erling Smørgrav.Fl u
97a0581bbcSDag-Erling Smørgravis specified,
98ac1070c6SDag-Erling Smørgrav.Nm
99a0581bbcSDag-Erling Smørgravwill list sockets in all three domains.
100a0581bbcSDag-Erling Smørgrav.Pp
101a0581bbcSDag-Erling SmørgravIf neither
102a0581bbcSDag-Erling Smørgrav.Fl c
103a0581bbcSDag-Erling Smørgravor
104a0581bbcSDag-Erling Smørgrav.Fl l
105a0581bbcSDag-Erling Smørgravis specified,
106a0581bbcSDag-Erling Smørgrav.Nm
107a0581bbcSDag-Erling Smørgravwill list both listening and connected sockets.
108ac1070c6SDag-Erling Smørgrav.Pp
10987faa07bSSheldon HearnThe information listed for each
11058278509SDag-Erling Smørgravsocket is:
11114802b60SDag-Erling Smørgrav.Bl -tag -width "FOREIGN ADDRESS"
11258278509SDag-Erling Smørgrav.It Li USER
11358278509SDag-Erling SmørgravThe user who owns the socket.
11458278509SDag-Erling Smørgrav.It Li COMMAND
11558278509SDag-Erling SmørgravThe command which holds the socket.
11658278509SDag-Erling Smørgrav.It Li PID
11758278509SDag-Erling SmørgravThe process ID of the command which holds the socket.
11858278509SDag-Erling Smørgrav.It Li FD
11958278509SDag-Erling SmørgravThe file descriptor number of the socket.
12058278509SDag-Erling Smørgrav.It Li PROTO
121ac1070c6SDag-Erling SmørgravThe transport protocol associated with the socket for Internet
1223ce0d6e8SRuslan Ermilovsockets, or the type of socket (stream or datagram) for
1233ce0d6e8SRuslan Ermilov.Ux
1243ce0d6e8SRuslan Ermilovsockets.
12558278509SDag-Erling Smørgrav.It Li LOCAL ADDRESS
126ca007d91SDag-Erling SmørgravFor Internet sockets, this is the address the local end of the socket
127ca007d91SDag-Erling Smørgravis bound to (see
12858278509SDag-Erling Smørgrav.Xr getsockname 2 ) .
129ca007d91SDag-Erling SmørgravFor bound
130ca007d91SDag-Erling Smørgrav.Ux
131ca007d91SDag-Erling Smørgravsockets, it is the socket's filename.
132ca007d91SDag-Erling SmørgravFor other
133ca007d91SDag-Erling Smørgrav.Ux
134ca007d91SDag-Erling Smørgravsockets, it is a right arrow followed by the endpoint's filename, or
135ca007d91SDag-Erling Smørgrav.Dq Li ??
136ca007d91SDag-Erling Smørgravif the endpoint could not be determined.
13758278509SDag-Erling Smørgrav.It Li FOREIGN ADDRESS
138ac1070c6SDag-Erling Smørgrav(Internet sockets only)
13958278509SDag-Erling SmørgravThe address the foreign end of the socket is bound to (see
14058278509SDag-Erling Smørgrav.Xr getpeername 2 ) .
14158278509SDag-Erling Smørgrav.El
14297c6143cSPeter Pentchev.Pp
14361149f8dSJilles TjoelkerIf a socket is associated with more than one file descriptor,
14461149f8dSJilles Tjoelkerit is shown multiple times.
14561149f8dSJilles TjoelkerIf a socket is not associated with any file descriptor,
14661149f8dSJilles Tjoelkerthe first four columns have no meaning.
14758278509SDag-Erling Smørgrav.Sh SEE ALSO
14858278509SDag-Erling Smørgrav.Xr fstat 1 ,
14914802b60SDag-Erling Smørgrav.Xr netstat 1 ,
150e5002279SEdward Tomasz Napierala.Xr procstat 1 ,
151482ca427SYoshinobu Inoue.Xr inet 4 ,
1521f3d67aaSGiorgos Keramidas.Xr inet6 4 ,
1531f3d67aaSGiorgos Keramidas.Xr protocols 5
15458278509SDag-Erling Smørgrav.Sh HISTORY
15558278509SDag-Erling SmørgravThe
15658278509SDag-Erling Smørgrav.Nm
15758278509SDag-Erling Smørgravcommand appeared in
15858278509SDag-Erling Smørgrav.Fx 3.1 .
15958278509SDag-Erling Smørgrav.Sh AUTHORS
16058278509SDag-Erling SmørgravThe
16158278509SDag-Erling Smørgrav.Nm
16258278509SDag-Erling Smørgravcommand and this manual page were written by
1632b7af31cSBaptiste Daroussin.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
164