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