BSD 4_3_Reno release
[unix-history] / usr / src / usr.bin / netstat / netstat.1
CommitLineData
b5dc1377 1.\" Copyright (c) 1983, 1990 The Regents of the University of California.
ac63c3f4 2.\" All rights reserved.
93874d5d 3.\"
1c15e888
C
4.\" Redistribution and use in source and binary forms are permitted provided
5.\" that: (1) source distributions retain this entire copyright notice and
6.\" comment, and (2) distributions including binaries display the following
7.\" acknowledgement: ``This product includes software developed by the
8.\" University of California, Berkeley and its contributors'' in the
9.\" documentation or other materials provided with the distribution and in
10.\" all advertising materials mentioning features or use of this software.
11.\" Neither the name of the University nor the names of its contributors may
12.\" be used to endorse or promote products derived from this software without
13.\" specific prior written permission.
14.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
ac63c3f4 17.\"
1c15e888 18.\" @(#)netstat.1 6.11 (Berkeley) 7/24/90
93874d5d 19.\"
1c15e888 20.Dd July 24, 1990
b5dc1377
CL
21.Dt NETSTAT 1
22.Os BSD 4.2
23.Sh NAME
24.Nm netstat
25.Nd show network status
26.Sh SYNOPSIS
27.Nm netstat
28.Op Fl Aan
dd9e2e8d 29.Op Fl f Ar address_family
b5dc1377
CL
30.Op Ar system
31.Op Ar core
32.Nm netstat
33.Op Fl himnrs
34.Op Fl f Ar address_family
35.Op Ar system
36.Op Ar core
37.Nm netstat
38.Op Fl n
39.Op Fl I Op Ar interface
40.Ar interval
41.Op Ar system
42.Op Ar core
43.Nm netstat
44.Op Fl p Ar protocol
45.Op Ar system
46.Op Ar core
47.Sh DESCRIPTION
93874d5d 48The
b5dc1377 49.Nm netstat
93874d5d 50command symbolically displays the contents of various network-related
84efacbd
MK
51data structures.
52There are a number of output formats,
53depending on the options for the information presented.
54The first form of the command displays a list of active sockets for
55each protocol.
56The second form presents the contents of one of the other network
57data structures according to the option selected.
b5dc1377
CL
58Using the third form, with an
59.Ar interval
84efacbd 60specified,
b5dc1377 61.Nm netstat
84efacbd
MK
62will continuously display the information regarding packet
63traffic on the configured network interfaces.
57d17fbd 64The fourth form displays statistics about the named protocol.
b5dc1377 65.Pp
84efacbd 66The options have the following meaning:
b5dc1377
CL
67.Tw Fl
68.Tp Fl A
84efacbd
MK
69With the default display,
70show the address of any protocol control blocks associated with sockets; used
71for debugging.
b5dc1377 72.Tp Fl a
84efacbd 73With the default display,
93874d5d 74show the state of all sockets; normally sockets used by
84efacbd 75server processes are not shown.
5325ced3 76.Tp Fl d
77560d37 77With either interface display (option
b5dc1377 78.Fl i
77560d37
MK
79or an interval, as described below),
80show the number of dropped packets.
b5dc1377 81.Tp Fl h
84efacbd 82Show the state of the IMP host table.
b5dc1377 83.Tp Fl i
84efacbd 84Show the state of interfaces which have been auto-configured
93874d5d 85(interfaces statically configured into a system, but not
84efacbd 86located at boot time are not shown).
b5dc1377
CL
87.Tp Cx Fl I
88.Ws
89.Ar interface
90.Cx
84efacbd
MK
91Show information only about this interface;
92used with an
b5dc1377 93.Ar interval
84efacbd 94as described below.
b5dc1377 95.Tp Fl m
84efacbd
MK
96Show statistics recorded by the memory management routines
97(the network manages a private pool of memory buffers).
b5dc1377
CL
98.Tp Fl n
99Show network addresses as numbers (normally
100.Nm netstat
93874d5d 101interprets addresses and attempts to display them
84efacbd
MK
102symbolically).
103This option may be used with any of the display formats.
b5dc1377
CL
104.Tp Cx Fl p
105.Ws
106.Ar protocol
107.Cx
108Show statistics about
109.Ar protocol ,
57d17fbd 110which is either a well-known name for a protocol or an alias for it. Some
b5dc1377
CL
111protocol names and aliases are listed in the file
112.Pa /etc/protocols .
113A null response typically means that there are no interesting numbers to
57d17fbd
MK
114report.
115The program will complain if
b5dc1377 116.Ar protocol
57d17fbd 117is unknown or if there is no statistics routine for it.
b5dc1377 118.Tp Fl s
84efacbd 119Show per-protocol statistics.
b5dc1377 120.Tp Fl r
84efacbd
MK
121Show the routing tables.
122When
b5dc1377 123.Fl s
84efacbd 124is also present, show routing statistics instead.
b5dc1377
CL
125.Tp Cx Fl f
126.Ws
127.Ar address_family
128.Cx
84efacbd 129Limit statistics or address control block reports to those
114898a7 130of the specified
b5dc1377 131.Ar address family .
84efacbd
MK
132The following address families
133are recognized:
b5dc1377 134.Ar inet ,
114898a7 135for
5325ced3 136.Li AF_INET ,
b5dc1377 137.Ar ns ,
114898a7 138for
5325ced3 139.Li AF_NS ,
84efacbd 140and
b5dc1377 141.Ar unix ,
84efacbd 142for
5325ced3 143.Li AF_UNIX .
b5dc1377
CL
144.Tp
145.Pp
146The arguments,
147.Ar system
93874d5d 148and
b5dc1377
CL
149.Ar core
150allow substitutes for the defaults
151.Dq Pa vmunix
152and
153.Dq Pa /dev/kmem .
154.Pp
84efacbd 155The default display, for active sockets, shows the local
93874d5d 156and remote addresses, send and receive queue sizes (in bytes), protocol,
84efacbd 157and the internal state of the protocol.
93874d5d
KM
158Address formats are of the form ``host.port'' or ``network.port''
159if a socket's address specifies a network but no specific host address.
160When known the host and network addresses are displayed symbolically
161according to the data bases
b5dc1377 162.Pa /etc/hosts
93874d5d 163and
b5dc1377 164.Pa /etc/networks ,
93874d5d 165respectively. If a symbolic name for an address is unknown, or if
b5dc1377
CL
166the
167.Fl n
84efacbd
MK
168option is specified, the address is printed numerically, according
169to the address family.
b5dc1377 170For more information regarding
84efacbd 171the Internet ``dot format,''
b5dc1377
CL
172refer to
173.Xr inet 3 ) .
93874d5d 174Unspecified,
b5dc1377
CL
175or ``wildcard'', addresses and ports appear as ``*''.
176.Pp
93874d5d
KM
177The interface display provides a table of cumulative
178statistics regarding packets transferred, errors, and collisions.
84efacbd 179The network addresses of the interface
93874d5d 180and the maximum transmission unit (``mtu'') are also displayed.
b5dc1377 181.Pp
93874d5d
KM
182The routing table display indicates the available routes and
183their status. Each route consists of a destination host or network
184and a gateway to use in forwarding packets. The flags field shows
84efacbd 185the state of the route (``U'' if ``up''), whether the route
77560d37
MK
186is to a gateway (``G''), whether the route was created dynamically
187by a redirect (``D''), and whether the route has been modified
188by a redirect (``M''). Direct routes are created for each
84efacbd
MK
189interface attached to the local host;
190the gateway field for such entries shows the address of the outgoing interface.
191The refcnt field gives the
93874d5d
KM
192current number of active uses of the route. Connection oriented
193protocols normally hold on to a single route for the duration of
84efacbd
MK
194a connection while connectionless protocols obtain a route while sending
195to the same destination.
196The use field provides a count of the number of packets
93874d5d
KM
197sent using that route. The interface entry indicates the network
198interface utilized for the route.
b5dc1377
CL
199.Pp
200When
201.Nm netstat
93874d5d 202is invoked with an
b5dc1377 203.Ar interval
93874d5d 204argument, it displays a running count of statistics related to
84efacbd
MK
205network interfaces. This display consists of a
206column for the primary interface
207(the first interface found during autoconfiguration)
208and a column summarizing
209information for all interfaces.
210The primary interface may be replaced with another interface with the
b5dc1377 211.Fl I
84efacbd
MK
212option.
213The first line of each screen of information contains a summary since the
93874d5d
KM
214system was last rebooted. Subsequent lines of output show values
215accumulated over the preceding interval.
b5dc1377
CL
216.Sh SEE ALSO
217.Xr iostat 1 ,
218.Xr vmstat 1 ,
219.Xr hosts 5 ,
220.Xr networks 5 ,
221.Xr protocols 5 ,
222.Xr services 5 ,
223.Xr trpt 8
224.Sh HISTORY
225.Nm Netstat
226appeared in 4.2 BSD.
227.Sh BUGS
93874d5d
KM
228The notion of errors is ill-defined. Collisions mean
229something else for the IMP.