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