xref: /freebsd/usr.bin/sockstat/sockstat.1 (revision 6414db1bc46b37c1a9e25eaf5367b4d885ba324c)
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*6414db1bSMichael Tuexen.Dd August 27, 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
387a5642b3SDag-Erling Smørgrav.Op Fl 46cLlsu
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
64f03482d4SMichael TuexenOnly show Internet sockets if the local and 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
7225044bbcSMichael 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 .
867a5642b3SDag-Erling Smørgrav.It Fl s
877a5642b3SDag-Erling SmørgravDisplay the protocol state, if applicable.
88*6414db1bSMichael TuexenThis is currently only implemented for SCTP and TCP.
89ac1070c6SDag-Erling Smørgrav.It Fl u
903ce0d6e8SRuslan ErmilovShow
913ce0d6e8SRuslan Ermilov.Dv AF_LOCAL
923ce0d6e8SRuslan Ermilov.Pq Ux
933ce0d6e8SRuslan Ermilovsockets.
94ac1070c6SDag-Erling Smørgrav.El
95ac1070c6SDag-Erling Smørgrav.Pp
96a0581bbcSDag-Erling SmørgravIf neither
973ce0d6e8SRuslan Ermilov.Fl 4 , 6
98a0581bbcSDag-Erling Smørgravor
99a0581bbcSDag-Erling Smørgrav.Fl u
100a0581bbcSDag-Erling Smørgravis specified,
101ac1070c6SDag-Erling Smørgrav.Nm
102a0581bbcSDag-Erling Smørgravwill list sockets in all three domains.
103a0581bbcSDag-Erling Smørgrav.Pp
104a0581bbcSDag-Erling SmørgravIf neither
105a0581bbcSDag-Erling Smørgrav.Fl c
106a0581bbcSDag-Erling Smørgravor
107a0581bbcSDag-Erling Smørgrav.Fl l
108a0581bbcSDag-Erling Smørgravis specified,
109a0581bbcSDag-Erling Smørgrav.Nm
110a0581bbcSDag-Erling Smørgravwill list both listening and connected sockets.
111ac1070c6SDag-Erling Smørgrav.Pp
11287faa07bSSheldon HearnThe information listed for each
11358278509SDag-Erling Smørgravsocket is:
11414802b60SDag-Erling Smørgrav.Bl -tag -width "FOREIGN ADDRESS"
11558278509SDag-Erling Smørgrav.It Li USER
11658278509SDag-Erling SmørgravThe user who owns the socket.
11758278509SDag-Erling Smørgrav.It Li COMMAND
11858278509SDag-Erling SmørgravThe command which holds the socket.
11958278509SDag-Erling Smørgrav.It Li PID
12058278509SDag-Erling SmørgravThe process ID of the command which holds the socket.
12158278509SDag-Erling Smørgrav.It Li FD
12258278509SDag-Erling SmørgravThe file descriptor number of the socket.
12358278509SDag-Erling Smørgrav.It Li PROTO
124ac1070c6SDag-Erling SmørgravThe transport protocol associated with the socket for Internet
125b8e20e2dSHiroki Satosockets, or the type of socket
126b8e20e2dSHiroki Sato.Pq stream, datagram, or seqpacket
127b8e20e2dSHiroki Satofor
1283ce0d6e8SRuslan Ermilov.Ux
1293ce0d6e8SRuslan Ermilovsockets.
13058278509SDag-Erling Smørgrav.It Li LOCAL ADDRESS
131ca007d91SDag-Erling SmørgravFor Internet sockets, this is the address the local end of the socket
132ca007d91SDag-Erling Smørgravis bound to (see
13358278509SDag-Erling Smørgrav.Xr getsockname 2 ) .
134ca007d91SDag-Erling SmørgravFor bound
135ca007d91SDag-Erling Smørgrav.Ux
136ca007d91SDag-Erling Smørgravsockets, it is the socket's filename.
137ca007d91SDag-Erling SmørgravFor other
138ca007d91SDag-Erling Smørgrav.Ux
139ca007d91SDag-Erling Smørgravsockets, it is a right arrow followed by the endpoint's filename, or
140ca007d91SDag-Erling Smørgrav.Dq Li ??
141ca007d91SDag-Erling Smørgravif the endpoint could not be determined.
14258278509SDag-Erling Smørgrav.It Li FOREIGN ADDRESS
143ac1070c6SDag-Erling Smørgrav(Internet sockets only)
14458278509SDag-Erling SmørgravThe address the foreign end of the socket is bound to (see
14558278509SDag-Erling Smørgrav.Xr getpeername 2 ) .
14658278509SDag-Erling Smørgrav.El
14797c6143cSPeter Pentchev.Pp
14861149f8dSJilles TjoelkerIf a socket is associated with more than one file descriptor,
14961149f8dSJilles Tjoelkerit is shown multiple times.
15061149f8dSJilles TjoelkerIf a socket is not associated with any file descriptor,
15161149f8dSJilles Tjoelkerthe first four columns have no meaning.
15258278509SDag-Erling Smørgrav.Sh SEE ALSO
15358278509SDag-Erling Smørgrav.Xr fstat 1 ,
15414802b60SDag-Erling Smørgrav.Xr netstat 1 ,
155e5002279SEdward Tomasz Napierala.Xr procstat 1 ,
156482ca427SYoshinobu Inoue.Xr inet 4 ,
1571f3d67aaSGiorgos Keramidas.Xr inet6 4 ,
1581f3d67aaSGiorgos Keramidas.Xr protocols 5
15958278509SDag-Erling Smørgrav.Sh HISTORY
16058278509SDag-Erling SmørgravThe
16158278509SDag-Erling Smørgrav.Nm
16258278509SDag-Erling Smørgravcommand appeared in
16358278509SDag-Erling Smørgrav.Fx 3.1 .
16458278509SDag-Erling Smørgrav.Sh AUTHORS
16558278509SDag-Erling SmørgravThe
16658278509SDag-Erling Smørgrav.Nm
16758278509SDag-Erling Smørgravcommand and this manual page were written by
1682b7af31cSBaptiste Daroussin.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
169