Debian Codegraph @

upstream/fedora-44/man8/netstat.8

raw
1 .\"
2 .\" netstat.8
3 .\"
4 .\" Original: ([email protected] & [email protected])
5 .\"
6 .\" Modified: [email protected]
7 .\" Modified: Andi Kleen [email protected]
8 .\" Modified: Tuan Hoang [email protected]
9 .\" Modified: Brian Micek [email protected]
10 .\"
11 .\"
12 .TH NETSTAT 8 "2014\-10\-07" "net\-tools" "Linux System Administrator's Manual"
13
14 .SH NAME
15 netstat \- Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
16
17 .SH SYNOPSIS
18
19 .B netstat
20 .RI [ address_family_options ]
21 .RB [ \-\-tcp | \-t ]
22 .RB [ \-\-udp | \-u ]
23 .RB [ \-\-udplite | \-U ]
24 .RB [ \-\-sctp | \-S ]
25 .RB [ \-\-raw | \-w ]
26 .RB [ \-\-l2cap | \-2 ]
27 .RB [ \-\-rfcomm | \-f ]
28 .RB [ \-\-listening | \-l ]
29 .RB [ \-\-all | \-a ]
30 .RB [ \-\-numeric | \-n ]
31 .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
32 .RB [ \-\-symbolic | \-N ]
33 .RB [ \-\-extend | \-e [ \-\-extend | \-e] ]
34 .RB [ \-\-timers | \-o ]
35 .RB [ \-\-program | \-p ]
36 .RB [ \-\-verbose | \-v ]
37 .RB [ \-\-continuous | \-c]
38 .RB [ \-\-wide | \-W ]
39 .RB [delay]
40 .P
41 .B netstat
42 .RB { \-\-route | \-r }
43 .RI [ address_family_options ]
44 .RB [ \-\-extend | \-e [ \-\-extend | \-e] ]
45 .RB [ \-\-verbose | \-v ]
46 .RB [ \-\-numeric | \-n ]
47 .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
48 .RB [ \-\-continuous | \-c ]
49 .RB [delay]
50 .P
51 .B netstat
52 .RB { \-\-interfaces | \-I | \-i }
53 .RB [ \-\-all | \-a ]
54 .RB [ \-\-extend | \-e ]
55 .RB [ \-\-verbose | \-v ]
56 .RB [ \-\-program | \-p ]
57 .RB [ \-\-numeric | \-n ]
58 .RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ]
59 .RB [ \-\-continuous | \-c ]
60 .RB [delay]
61 .P
62 .B netstat
63 .RB { \-\-groups | \-g }
64 .RB [ \-\-numeric | \-n ]
65 .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
66 .RB [ \-\-continuous | \-c ]
67 .RB [delay]
68 .P
69 .B netstat
70 .RB { \-\-masquerade | \-M }
71 .RB [ \-\-extend | \-e ]
72 .RB [ \-\-numeric | \-n ]
73 .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
74 .RB [ \-\-continuous | \-c ]
75 .RB [delay]
76 .P
77 .B netstat
78 .RB { \-\-statistics | -s }
79 .RB [ \-\-tcp | \-t ]
80 .RB [ \-\-udp | \-u ]
81 .RB [ \-\-udplite | \-U ]
82 .RB [ \-\-sctp | \-S ]
83 .RB [ \-\-raw | \-w ]
84 .RB [delay]
85 .P
86 .B netstat
87 .RB { \-\-version | \-V }
88 .P
89 .B netstat
90 .RB { \-\-help | \-h }
91 .P
92 .IR address_family_options :
93 .PP
94 .RB [ -4 | \-\-inet ]
95 .RB [ -6 | \-\-inet6 ]
96 .RB [ \-\-protocol= { inet , inet6 , unix , ipx , ax25 , netrom , ddp , bluetooth ", ... } ]"
97 .RB [ \-\-unix | \-x ]
98 .RB [ \-\-inet | \-\-ip | \-\-tcpip ]
99 .RB [ \-\-ax25 ]
100 .RB [ \-\-x25 ]
101 .RB [ \-\-rose ]
102 .RB [ \-\-ash ]
103 .RB [ \-\-bluetooth ]
104 .RB [ \-\-ipx ]
105 .RB [ \-\-netrom ]
106 .RB [ \-\-ddp | \-\-appletalk ]
107 .RB [ \-\-econet | \-\-ec ]
108
109 .SH NOTES
110 This program is mostly obsolete.
111 Replacement for \fBnetstat\fR is \fBss\fR.
112 Replacement for \fBnetstat -r\fR is \fBip route\fR.
113 Replacement for \fBnetstat -i\fR is \fBip -s link\fR.
114 Replacement for \fBnetstat -g\fR is \fBip maddr\fR.
115
116 .SH DESCRIPTION
117 .B Netstat
118 prints information about the Linux networking subsystem. The type of
119 information printed is controlled by the first argument, as follows:
120 .SS (none)
121 By default,
122 .B
123 netstat
124 displays a list of open sockets. If you don't specify any
125 address families, then the active sockets of all configured address
126 families will be printed.
127 .SS "\-\-route, \-r"
128 Display the kernel routing tables. See the description in
129 .BR route (8)
130 for details.
131 .B netstat -r
132 and
133 .B route -e
134 produce the same output.
135 .SS "\-\-groups, \-g"
136 Display multicast group membership information for IPv4 and IPv6.
137 .SS "\-\-interfaces=\fIiface \fR, \fB\-I=\fIiface \fR, \fB\-i"
138 Display a table of all network interfaces, or the specified \fIiface\fR.
139 .SS "\-\-masquerade, \-M"
140 Display a list of masqueraded connections.
141 .SS "\-\-statistics, \-s"
142 Display summary statistics for each protocol.
143 .SH OPTIONS
144 .SS "\-\-verbose, \-v"
145 Tell the user what is going on by being verbose. Especially print some
146 useful information about unconfigured address families.
147 .SS "\-\-wide, \-W"
148 Do not truncate IP addresses by using output as wide as needed. This is
149 optional for now to not break existing scripts.
150 .SS "\-\-numeric, \-n"
151 Show numerical addresses instead of trying to determine symbolic host, port
152 or user names.
153 .SS "\-\-numeric\-hosts"
154 shows numerical host addresses but does not affect the resolution of
155 port or user names.
156 .SS "\-\-numeric\-ports"
157 shows numerical port numbers but does not affect the resolution of
158 host or user names.
159 .SS "\-\-numeric\-users"
160 shows numerical user IDs but does not affect the resolution of host or
161 port names.
162
163 .SS "\-\-protocol=\fIfamily\fR, \fB\-A"
164 Specifies the address families (perhaps better described as low level
165 protocols) for which connections are to be shown.
166 .I family
167 is a comma (',') separated list of address family keywords like
168 .BR inet ,
169 .BR inet6 ,
170 .BR unix ,
171 .BR ipx ,
172 .BR ax25 ,
173 .BR netrom ,
174 .BR econet ,
175 .BR ddp ,
176 and
177 .BR bluetooth .
178 This has the same effect as using the
179 .BR \-\-inet | -4 ,
180 .BR \-\-inet6 | -6 ,
181 .BR \-\-unix | -x ,
182 .BR \-\-ipx ,
183 .BR \-\-ax25 ,
184 .BR \-\-netrom ,
185 .BR \-\-ddp ,
186 and
187 .B \-\-bluetooth
188 options.
189 .P
190 The address family
191 .B inet
192 (Iv4) includes raw, udp, udplite and tcp protocol sockets.
193 .P
194 The address family
195 .B bluetooth
196 (Iv4) includes l2cap and rfcomm protocol sockets.
197 .SS "\-c, \-\-continuous"
198 This will cause
199 .B netstat
200 to print the selected information every second continuously.
201 .SS "\-e, \-\-extend"
202 Display additional information. Use this option twice for maximum detail.
203 .SS "\-o, \-\-timers"
204 Include information related to networking timers.
205 .SS "\-p, \-\-program"
206 Show the PID and name of the program to which each socket belongs.
207 .SS "\-l, \-\-listening"
208 Show only listening sockets. (These are omitted by default.)
209 .SS "\-a, \-\-all"
210 Show both listening and non-listening (for TCP this means established
211 connections) sockets. With the
212 .B \-\-interfaces
213 option, show interfaces that are not up
214 .SS "\-F"
215 Print routing information from the FIB. (This is the default.)
216 .SS "\-C"
217 Print routing information from the route cache.
218 .SS delay
219 Netstat will cycle printing through statistics every
220 .B delay
221 seconds.
222 .P
223 .SH OUTPUT
224 .P
225 .SS Active Internet connections \fR(TCP, UDP, UDPLite, raw)\fR
226 .SS "Proto"
227 The protocol (tcp, udp, udpl, raw) used by the socket.
228 .SS "Recv\-Q"
229 Established: The count of bytes not copied by the user program connected to this socket.
230 Listening: Since Kernel 2.6.18 this column contains the current syn backlog.
231 .SS "Send\-Q"
232 Established: The count of bytes not acknowledged by the remote host.
233 Listening: Since Kernel 2.6.18 this column contains the maximum size of the syn backlog.
234 .SS "Local Address"
235 Address and port number of the local end of the socket. Unless the
236 .BR \-\-numeric " (" \-n )
237 option is specified, the socket address is resolved to its canonical
238 host name (FQDN), and the port number is translated into the
239 corresponding service name.
240 .SS "Foreign Address"
241 Address and port number of the remote end of the socket.
242 Analogous to "Local Address".
243 .SS "State"
244 The state of the socket. Since there are no states in raw mode and usually no
245 states used in UDP and UDPLite, this column may be left blank. Normally this can be one
246 of several values:
247 .TP
248 .I
249 ESTABLISHED
250 The socket has an established connection.
251 .TP
252 .I
253 SYN_SENT
254 The socket is actively attempting to establish a connection.
255 .TP
256 .I
257 SYN_RECV
258 A connection request has been received from the network.
259 .TP
260 .I
261 FIN_WAIT1
262 The socket is closed, and the connection is shutting down.
263 .TP
264 .I
265 FIN_WAIT2
266 Connection is closed, and the socket is waiting for a shutdown from the
267 remote end.
268 .TP
269 .I
270 TIME_WAIT
271 The socket is waiting after close to handle packets still in the network.
272 .TP
273 .I
274 CLOSE
275 The socket is not being used.
276 .TP
277 .I
278 CLOSE_WAIT
279 The remote end has shut down, waiting for the socket to close.
280 .TP
281 .I
282 LAST_ACK
283 The remote end has shut down, and the socket is closed. Waiting for
284 acknowledgement.
285 .TP
286 .I
287 LISTEN
288 The socket is listening for incoming connections. Such sockets are
289 not included in the output unless you specify the
290 .BR \-\-listening " (" \-l )
291 or
292 .BR \-\-all " (" \-a )
293 option.
294 .TP
295 .I
296 CLOSING
297 Both sockets are shut down but we still don't have all our data
298 sent.
299 .TP
300 .I
301 UNKNOWN
302 The state of the socket is unknown.
303 .SS "User"
304 The username or the user id (UID) of the owner of the socket.
305 .SS "PID/Program name"
306 Slash-separated pair of the process id (PID) and process name of the
307 process that owns the socket.
308 .B \-\-program
309 causes this column to be included. You will also need
310 .I superuser
311 privileges to see this information on sockets you don't own. This
312 identification information is not yet available for IPX sockets.
313 .SS "Timer"
314 TCP timer associated with this socket. The format is timer(a/b/c). The timer is one of the following values:
315 .TP
316 .I
317 off
318 There is no timer set for this socket.
319 .TP
320 .I
321 on
322 The retransmission timer is active for the socket.
323 .TP
324 .I
325 keepalive
326 The keepalive timer is active for the socket.
327 .TP
328 .I
329 timewait
330 The connection is closing and the timewait timer is active for the socket.
331 .P
332 The values in the brackets:
333 .TP
334 .I
335 a
336 Timer value.
337 .TP
338 .I
339 b
340 Number of retransmissions sent.
341 .TP
342 .I
343 c
344 Number of keepalives sent.
345 .P
346 .SS Active UNIX domain Sockets
347 .SS "Proto"
348 The protocol (usually unix) used by the socket.
349 .SS "RefCnt"
350 The reference count (i.e. attached processes via this socket).
351 .SS "Flags"
352 The flags displayed is SO_ACCEPTON (displayed as
353 .BR ACC ),
354 SO_WAITDATA
355 .RB ( W )
356 or SO_NOSPACE
357 .RB ( N ).
358 SO_ACCECPTON
359 is used on unconnected sockets if their corresponding
360 processes are waiting for a connect request. The other flags are not
361 of normal interest.
362 .SS "Type"
363 There are several types of socket access:
364 .TP
365 .I
366 SOCK_DGRAM
367 The socket is used in Datagram (connectionless) mode.
368 .TP
369 .I
370 SOCK_STREAM
371 This is a stream (connection) socket.
372 .TP
373 .I
374 SOCK_RAW
375 The socket is used as a raw socket.
376 .TP
377 .I
378 SOCK_RDM
379 This one serves reliably-delivered messages.
380 .TP
381 .I
382 SOCK_SEQPACKET
383 This is a sequential packet socket.
384 .TP
385 .I
386 SOCK_PACKET
387 Raw interface access socket.
388 .TP
389 .I
390 UNKNOWN
391 Who ever knows what the future will bring us - just fill in here :-)
392 .PP
393 .SS "State"
394 This field will contain one of the following Keywords:
395 .TP
396 .I FREE
397 The socket is not allocated
398 .TP
399 .I LISTENING
400 The socket is listening for a connection request. Such
401 sockets are only included in the output if you specify the
402 .BR \-\-listening " (" \-l )
403 or
404 .BR \-\-all " (" \-a )
405 option.
406 .TP
407 .I CONNECTING
408 The socket is about to establish a connection.
409 .TP
410 .I CONNECTED
411 The socket is connected.
412 .TP
413 .I DISCONNECTING
414 The socket is disconnecting.
415 .TP
416 .I (empty)
417 The socket is not connected to another one.
418 .TP
419 .I UNKNOWN
420 This state should never happen.
421 .SS "PID/Program name"
422 Process ID (PID) and process name of the process that has the socket open.
423 More info available in
424 .B "Active Internet connections"
425 section written above.
426 .SS "Path"
427 This is the path name as which the corresponding processes attached
428 to the socket.
429 .P
430 .SS Active IPX sockets
431 (this needs to be done by somebody who knows it)
432 .P
433 .SS Active NET/ROM sockets
434 (this needs to be done by somebody who knows it)
435 .P
436 .SS Active AX.25 sockets
437 (this needs to be done by somebody who knows it)
438 .PP
439
440 .SH FILES
441 .ta
442 .I /etc/services
443 -- The services translation file
444
445 .I /proc
446 -- Mount point for the proc filesystem, which gives access to kernel
447 status information via the following files.
448
449 .I /proc/net/dev
450 -- device information
451
452 .I /proc/net/raw
453 -- raw socket information
454
455 .I /proc/net/tcp
456 -- TCP socket information
457
458 .I /proc/net/udp
459 -- UDP socket information
460
461 .I /proc/net/udplite
462 -- UDPLite socket information
463
464 .I /proc/net/igmp
465 -- IGMP multicast information
466
467 .I /proc/net/unix
468 -- Unix domain socket information
469
470 .I /proc/net/ipx
471 -- IPX socket information
472
473 .I /proc/net/ax25
474 -- AX25 socket information
475
476 .I /proc/net/appletalk
477 -- DDP (appletalk) socket information
478
479 .I /proc/net/nr
480 -- NET/ROM socket information
481
482 .I /proc/net/route
483 -- IP routing information
484
485 .I /proc/net/ax25_route
486 -- AX25 routing information
487
488 .I /proc/net/ipx_route
489 -- IPX routing information
490
491 .I /proc/net/nr_nodes
492 -- NET/ROM nodelist
493
494 .I /proc/net/nr_neigh
495 -- NET/ROM neighbours
496
497 .I /proc/net/ip_masquerade
498 -- masqueraded connections
499
500 .I /sys/kernel/debug/bluetooth/l2cap
501 -- Bluetooth L2CAP information
502
503 .I /sys/kernel/debug/bluetooth/rfcomm
504 -- Bluetooth serial connections
505
506 .I /proc/net/snmp
507 -- statistics
508 .fi
509 .P
510 .SH SEE ALSO
511 .BR route (8),
512 .BR ifconfig (8),
513 .BR iptables (8),
514 .BR proc (5)
515 .BR ss (8)
516 .BR ip (8)
517 .P
518 .SH BUGS
519 Occasionally strange information may appear if a socket changes
520 as it is viewed. This is unlikely to occur.
521 .P
522 .SH AUTHORS
523 The netstat user interface was written by Fred Baumgarten
524 <[email protected]\-karlsruhe.de>, the man page basically
525 by Matt Welsh <[email protected]>. It was updated by
526 Alan Cox <[email protected]>, updated again by Tuan Hoang
527 <[email protected]>. The man page and the command included
528 in the net\-tools package is totally rewritten by Bernd Eckenfels
529 <[email protected]>. UDPLite options were added by Brian Micek
530 <[email protected]>