Imported upstream version 1.5
[manpages-zh.git] / raw / man8 / netstat.8
blobb803eb8029705f9e4185de086f8e8f26d9ac2253
1 .\"
2 .\" netstat.8 
3 .\"
4 .\" Original: (mdw@tc.cornell.edu & dc6iq@insu1.etec.uni-karlsruhe.de)
5 .\"
6 .\" Modified: Bernd.Eckenfels@inka.de
7 .\" Modified: Andi Kleen ak@muc.de 
8 .\" Modified: Tuan Hoang tqhoang@bigfoot.com 
9 .\"
10 .\"
11 .TH NETSTAT 8 "19 December 2000" "net-tools" "Linux Programmer's Manual"
13 .SH NAME
14 netstat \- Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
16 .SH SYNOPSIS
18 .B netstat 
19 .RI [ address_family_options ]
20 .RB [ \-\-tcp | \-t ]
21 .RB [ \-\-udp | \-u ]
22 .RB [ \-\-raw | \-w ]
23 .RB [ \-\-listening | \-l ]
24 .RB [ \-\-all | \-a ]
25 .RB [ \-\-numeric | \-n ]
26 .RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
27 .RB [ \-\-symbolic | \-N ]
28 .RB [ \-\-extend | \-e  [ \-\-extend | \-e] ]
29 .RB [ \-\-timers | \-o ]
30 .RB [ \-\-program | \-p ]
31 .RB [ \-\-verbose | \-v ]
32 .RB [ \-\-continuous | \-c]
33 .RB [delay]
35 .B netstat 
36 .RB { \-\-route | \-r }
37 .RI [ address_family_options ]
38 .RB [ \-\-extend | \-e  [ \-\-extend | \-e] ]
39 .RB [ \-\-verbose | \-v ]
40 .RB [ \-\-numeric | \-n ]
41 .RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
42 .RB [ \-\-continuous | \-c]
43 .RB [delay]
45 .B netstat
46 .RB { \-\-interfaces | \-i }
47 .RI [ iface ]
48 .RB [ \-\-all | \-a ]
49 .RB [ \-\-extend | \-e  [ \-\-extend | \-e] ]
50 .RB [ \-\-verbose | \-v ]
51 .RB [ \-\-program | \-p ]
52 .RB [ \-\-numeric | \-n ]
53 .RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
54 .RB [ \-\-continuous | \-c]
55 .RB [delay]
57 .B netstat
58 .RB { \-\-groups | \-g }
59 .RB [ \-\-numeric | \-n ]
60 .RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
61 .RB [ \-\-continuous | \-c]
62 .RB [delay]
64 .B netstat
65 .RB { \-\-masquerade | \-M }
66 .RB [ \-\-extend | \-e ]
67 .RB [ \-\-numeric | \-n ]
68 .RB [ \-\-numeric-hosts ] [ \-\-numeric-ports ] [ \-\-numeric-ports ]
69 .RB [ \-\-continuous | \-c]
70 .RB [delay]
72 .B netstat
73 .RB { \-\-statistics | -s }
74 .RB [ \-\-tcp | \-t ]
75 .RB [ \-\-udp | \-u ]
76 .RB [ \-\-raw | \-w ]
77 .RB [delay]
79 .B netstat 
80 .RB { \-\-version | \-V }
82 .B netstat 
83 .RB { \-\-help | \-h }
85 .IR address_family_options :
86 .PP
87 .RB [ \-\-protocol= { inet , unix , ipx , ax25 , netrom , ddp }[, ...] ]
88 .RB [ \-\-unix | \-x ] 
89 .RB [ \-\-inet | \-\-ip ]
90 .RB [ \-\-ax25 ]
91 .RB [ \-\-ipx ] 
92 .RB [ \-\-netrom ]
93 .RB [ \-\-ddp ]
95 .SH DESCRIPTION
96 .B Netstat
97 prints information about the Linux networking subsystem.  The type of
98 information printed is controlled by the first argument, as follows:
99 .SS (none)
100 By default,
102 netstat 
103 displays a list of open sockets.  If you don't specify any
104 address families, then the active sockets of all configured address
105 families will be printed.
106 .SS "\-\-route , \-r"
107 Display the kernel routing tables.
108 .SS "\-\-groups , \-g"
109 Display multicast group membership information for IPv4 and IPv6.
110 .SS "\-\-interface=\fIiface \fR, \fB\-i"
111 Display a table of all network interfaces, or the specified
112 .IR iface ) .
113 .SS "\-\-masquerade , \-M"
114 Display a list of masqueraded connections.
115 .SS "\-\-statistics , \-s"
116 Display summary statistics for each protocol.
117 .SH OPTIONS
118 .SS "\-\-verbose , \-v"
119 Tell the user what is going on by being verbose. Especially print some
120 useful information about unconfigured address families.
121 .SS "\-\-numeric , \-n"
122 Show numerical addresses instead of trying to determine symbolic host, port
123 or user names.
124 .SS "\-\-numeric-hosts"
125 shows numerical host addresses but does not affect the resolution of
126 port or user names.
127 .SS "\-\-numeric-ports"
128 shows numerical port numbers but does not affect the resolution of
129 host or user names.
130 .SS "\-\-numeric-users"
131 shows numerical user IDs but does not affect the resolution of host or
132 port names.
134 .SS "\-\-protocol=\fIfamily \fR, \fB\-A"
135 Specifies the address families (perhaps better described as low level
136 protocols) for which connections are to be shown.
137 .I family 
138 is a comma (',') separated list of address family keywords like
139 .BR inet , 
140 .BR unix , 
141 .BR ipx , 
142 .BR ax25 , 
143 .BR netrom ,
145 .BR ddp .
146 This has the same effect as using the 
147 .BR \-\-inet ,
148 .BR \-\-unix " (" \-x ),
149 .BR \-\-ipx ,
150 .BR \-\-ax25 ,
151 .BR \-\-netrom ,
153 .B \-\-ddp 
154 options.
156 The address family
157 .B inet
158 includes raw, udp and tcp protocol sockets.
159 .SS "\-c, \-\-continuous"
160 This will cause
161 .B netstat
162 to print the selected information every second continuously.
163 .SS "\-e, \-\-extend"
164 Display additional information.  Use this option twice for maximum detail.
165 .SS "\-o, \-\-timers"
166 Include information related to networking timers.
167 .SS "\-p, \-\-program"
168 Show the PID and name of the program to which each socket belongs.
169 .SS "\-l, \-\-listening"
170 Show only listening sockets.  (These are omitted by default.)
171 .SS "\-a, \-\-all"
172 Show both listening and non-listening sockets.  With the
173 .B --interfaces
174 option, show interfaces that are not marked 
175 .SS "\-F"
176 Print routing information from the FIB.  (This is the default.)
177 .SS "\-C"
178 Print routing information from the route cache.
179 .SS delay
180 Netstat will cycle printing through statistics every 
181 .B delay 
182 seconds.
183 .IR UP .
185 .SH OUTPUT
187 .SS Active Internet connections \fR(TCP, UDP, raw)\fR
188 .SS "Proto" 
189 The protocol (tcp, udp, raw) used by the socket. 
190 .SS "Recv-Q"
191 The count of bytes not copied by the user program connected to this socket.
192 .SS "Send-Q"
193 The count of bytes not acknowledged by the remote host.
194 .SS "Local Address" 
195 Address and port number of the local end of the socket.  Unless the
196 .BR \-\-numeric " (" \-n )
197 option is specified, the socket address is resolved to its canonical
198 host name (FQDN), and the port number is translated into the
199 corresponding service name.
200 .SS "Foreign Address"
201 Address and port number of the remote end of the socket.
202 Analogous to "Local Address."
203 .SS "State"
204 The state of the socket. Since there are no states in raw mode and usually no
205 states used in UDP, this column may be left blank. Normally this can be one
206 of several values:
209 ESTABLISHED
210 The socket has an established connection.
213 SYN_SENT
214 The socket is actively attempting to establish a connection.
217 SYN_RECV
218 A connection request has been received from the network.
221 FIN_WAIT1
222 The socket is closed, and the connection is shutting down.
225 FIN_WAIT2
226 Connection is closed, and the socket is waiting for a shutdown from the
227 remote end.
230 TIME_WAIT
231 The socket is waiting after close to handle packets still in the network.
234 CLOSED
235 The socket is not being used.
238 CLOSE_WAIT
239 The remote end has shut down, waiting for the socket to close.
242 LAST_ACK
243 The remote end has shut down, and the socket is closed. Waiting for
244 acknowledgement.
247 LISTEN
248 The socket is listening for incoming connections.  Such sockets are 
249 not included in the output unless you specify the 
250 .BR \-\-listening " (" \-l )
251 or 
252 .BR \-\-all " (" \-a )
253 option.
256 CLOSING
257 Both sockets are shut down but we still don't have all our data
258 sent.
261 UNKNOWN
262 The state of the socket is unknown.
263 .SS "User"
264 The username or the user id (UID) of the owner of the socket.
265 .SS "PID/Program name"
266 Slash-separated pair of the process id (PID) and process name of the 
267 process that owns the socket.
268 .B --program
269 causes this column to be included.  You will also need
270 .I superuser
271 privileges to see this information on sockets you don't own.  This
272 identification information is not yet available for IPX sockets.
273 .SS "Timer"
274 (this needs to be written)
276 .SS Active UNIX domain Sockets
277 .SS "Proto" 
278 The protocol (usually unix) used by the socket.
279 .SS "RefCnt"
280 The reference count (i.e. attached processes via this socket).
281 .SS "Flags"
282 The flags displayed is SO_ACCEPTON (displayed as 
283 .BR ACC ),
284 SO_WAITDATA 
285 .RB ( W )
286 or SO_NOSPACE 
287 .RB ( N ). 
288 SO_ACCECPTON 
289 is used on unconnected sockets if their corresponding
290 processes are waiting for a connect request. The other flags are not
291 of normal interest.
292 .SS "Type"
293 There are several types of socket access:
296 SOCK_DGRAM
297 The socket is used in Datagram (connectionless) mode.
300 SOCK_STREAM
301 This is a stream (connection) socket.
304 SOCK_RAW
305 The socket is used as a raw socket.
308 SOCK_RDM
309 This one serves reliably-delivered messages.
312 SOCK_SEQPACKET
313 This is a sequential packet socket.
316 SOCK_PACKET
317 Raw interface access socket.
320 UNKNOWN
321 Who ever knows what the future will bring us - just fill in here :-)
323 .SS "State"
324 This field will contain one of the following Keywords:
326 .I FREE
327 The socket is not allocated
329 .I LISTENING 
330 The socket is listening for a connection request.  Such
331 sockets are only included in the output if you specify the
332 .BR \-\-listening " (" \-l )
334 .BR \-\-all " (" \-a )
335 option.
337 .I CONNECTING
338 The socket is about to establish a connection.
340 .I CONNECTED
341 The socket is connected.
343 .I DISCONNECTING
344 The socket is disconnecting.
346 .I (empty)
347 The socket is not connected to another one.
349 .I UNKNOWN
350 This state should never happen.
351 .SS "PID/Program name"
352 Process ID (PID) and process name of the process that has the socket open. 
353 More info available in
354 .B "Active Internet connections"
355 section written above.
356 .SS "Path"
357 This is the path name as which the corresponding processes attached
358 to the socket.
360 .SS Active IPX sockets
361 (this needs to be done by somebody who knows it)
363 .SS Active NET/ROM sockets
364 (this needs to be done by somebody who knows it)
366 .SS Active AX.25 sockets
367 (this needs to be done by somebody who knows it)
369 .SH NOTES
370 Starting with Linux release 2.2 
371 .B netstat -i 
372 does not show interface statistics for alias interfaces. To get per
373 alias interface counters you need to setup explicit rules using the
374 .BR ipchains(8) 
375 command.  
377 .SH FILES
379 .I /etc/services
380 -- The services translation file
382 .I /proc
383 -- Mount point for the proc filesystem, which gives access to kernel 
384 status information via the following files.
386 .I /proc/net/dev
387 -- device information
389 .I /proc/net/raw
390 -- raw socket information
392 .I /proc/net/tcp
393 -- TCP socket information
395 .I /proc/net/udp
396 -- UDP socket information
398 .I /proc/net/igmp
399 -- IGMP multicast information
401 .I /proc/net/unix
402 -- Unix domain socket information
404 .I /proc/net/ipx
405 -- IPX socket information
407 .I /proc/net/ax25
408 -- AX25 socket information
410 .I /proc/net/appletalk
411 -- DDP (appletalk) socket information
413 .I /proc/net/nr
414 -- NET/ROM socket information
416 .I /proc/net/route
417 -- IP routing information
419 .I /proc/net/ax25_route
420 -- AX25 routing information
422 .I /proc/net/ipx_route
423 -- IPX routing information
425 .I /proc/net/nr_nodes
426 -- NET/ROM nodelist
428 .I /proc/net/nr_neigh
429 -- NET/ROM neighbours
431 .I /proc/net/ip_masquerade
432 -- masqueraded connections
434 .I /proc/net/snmp
435 -- statistics
438 .SH SEE ALSO
439 .BR route (8), 
440 .BR ifconfig (8), 
441 .BR ipchains (8),
442 .BR iptables (8),
443 .BR proc (5)
445 .SH BUGS
446 Occasionally strange information may appear if a socket changes
447 as it is viewed. This is unlikely to occur.
449 .SH AUTHORS
450 The netstat user interface was written by Fred Baumgarten
451 <dc6iq@insu1.etec.uni-karlsruhe.de> the man page basically
452 by Matt Welsh <mdw@tc.cornell.edu>. It was updated by
453 Alan Cox <Alan.Cox@linux.org> but could do with a bit more
454 work.  It was updated again by Tuan Hoang
455 <tqhoang@bigfoot.com>.
457 The man page and the command included in the net-tools
458 package is totally rewritten by Bernd Eckenfels 
459 <ecki@linux.de>.