add copyright
[unix-history] / usr / src / usr.bin / netstat / netstat.1
CommitLineData
93874d5d
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
b8edfa5e 5.\" @(#)netstat.1 6.1 (Berkeley) %G%
93874d5d 6.\"
b8edfa5e 7.TH NETSTAT 1 ""
93874d5d
KM
8.UC 5
9.SH NAME
10netstat \- show network status
11.SH SYNOPSIS
12.B netstat
13[
14.B \-Aahimnrs
15] [
b8edfa5e
KM
16.B \-I
17.I interface
93874d5d 18] [
b8edfa5e
KM
19.B \-p
20.I protocol
93874d5d
KM
21] [
22.I interval
23] [
24.I system
25] [
26.I core
27]
28.SH DESCRIPTION
29The
30.I netstat
31command symbolically displays the contents of various network-related
32data structures. The options have the following meaning:
33.TP
34.B \-A
35show the address of any associated protocol control blocks; used
36for debugging
37.TP
38.B \-a
39show the state of all sockets; normally sockets used by
40server processes are not shown
41.TP
42.B \-h
43show the state of the IMP host table
44.TP
45.B \-i
46show the state of interfaces which have been auto-configured
47(interfaces statically configured into a system, but not
48located at boot time are not shown)
49.TP
b8edfa5e
KM
50.BI \-I " interface"
51show information only about this interface
52(see also
53.I interval
54below)
55.TP
93874d5d
KM
56.B \-m
57show statistics recorded by the memory management routines
58(the network manages a ``private share'' of memory)
59.TP
60.B \-n
61show network addresses as numbers (normally
62.I netstat
63interprets addresses and attempts to display them
64symbolically)
65.TP
66.BI \-p " proto"
67show the state of sockets utilizing protocol
68.IR proto ;
69the protocol is specified symbolically, and may be any
70protocol listed in the file
71.IR /etc/protocols .
72.TP
73.B \-s
74show per-protocol statistics
75.TP
76.B \-r
77show the routing tables
78.PP
79The arguments,
80.I system
81and
82.I core
83allow substitutes for the defaults ``/vmunix'' and ``/dev/kmem''.
84.PP
85If an
86.I interval
87is specified,
88.I netstat
89will continuously display the information regarding packet
90traffic on the configured network interfaces, pausing
91.I interval
92seconds before refreshing the screen.
93.PP
94There are a number of display formats, depending on the information
95presented. The default display, for active sockets, shows the local
96and remote addresses, send and receive queue sizes (in bytes), protocol,
97and, optionally, the internal state of the protocol.
98.PP
99Address formats are of the form ``host.port'' or ``network.port''
100if a socket's address specifies a network but no specific host address.
101When known the host and network addresses are displayed symbolically
102according to the data bases
103.I /etc/hosts
104and
105.IR /etc/networks ,
106respectively. If a symbolic name for an address is unknown, or if
107the
108.B \-n
109option is specified, the address is printed in the Internet ``dot format'';
110refer to
111.IR inet (3N)
112for more information regarding this format.
113Unspecified,
114or ``wildcard'', addresses and ports appear as ``*''.
115.PP
116The interface display provides a table of cumulative
117statistics regarding packets transferred, errors, and collisions.
118The network address (currently Internet specific) of the interface
119and the maximum transmission unit (``mtu'') are also displayed.
120.PP
121The routing table display indicates the available routes and
122their status. Each route consists of a destination host or network
123and a gateway to use in forwarding packets. The flags field shows
124the state of the route (``U'' if ``up''), and whether the route
125is to a gateway (``G''). Direct routes are created for each
126interface attached to the local host. The refcnt field gives the
127current number of active uses of the route. Connection oriented
128protocols normally hold on to a single route for the duration of
129a connection while connectionless protocols obtain a route then
130discard it. The use field provides a count of the number of packets
131sent using that route. The interface entry indicates the network
132interface utilized for the route.
133.PP
134When
135.I netstat
136is invoked with an
137.I interval
138argument, it displays a running count of statistics related to
139network interfaces. This display consists of a column summarizing
140information for all interfaces, and a column for the interface with
141the most traffic since the system was last rebooted. The first
142line of each screen of information contains a summary since the
143system was last rebooted. Subsequent lines of output show values
144accumulated over the preceding interval.
145.SH SEE ALSO
146iostat(1),
147vmstat(1),
148hosts(5),
149networks(5),
150protocols(5),
151services(5),
152trpt(8C)
153.SH BUGS
154The notion of errors is ill-defined. Collisions mean
155something else for the IMP.