]> git.proxmox.com Git - mirror_iproute2.git/blob - man/man8/ss.8
Merge branch 'master' into next
[mirror_iproute2.git] / man / man8 / ss.8
1 .TH SS 8
2 .SH NAME
3 ss \- another utility to investigate sockets
4 .SH SYNOPSIS
5 .B ss
6 .RI [ options ] " [ FILTER ]"
7 .SH DESCRIPTION
8 .B ss
9 is used to dump socket statistics. It allows showing information similar
10 to
11 .IR netstat .
12 It can display more TCP and state information than other tools.
13
14 .SH OPTIONS
15 When no option is used ss displays a list of open non-listening
16 sockets (e.g. TCP/UNIX/UDP) that have established connection.
17 .TP
18 .B \-h, \-\-help
19 Show summary of options.
20 .TP
21 .B \-V, \-\-version
22 Output version information.
23 .TP
24 .B \-H, \-\-no-header
25 Suppress header line.
26 .TP
27 .B \-O, \-\-oneline
28 Print each socket's data on a single line.
29 .TP
30 .B \-n, \-\-numeric
31 Do not try to resolve service names. Show exact bandwidth values, instead of human-readable.
32 .TP
33 .B \-r, \-\-resolve
34 Try to resolve numeric address/ports.
35 .TP
36 .B \-a, \-\-all
37 Display both listening and non-listening (for TCP this means
38 established connections) sockets.
39 .TP
40 .B \-l, \-\-listening
41 Display only listening sockets (these are omitted by default).
42 .TP
43 .B \-o, \-\-options
44 Show timer information. For TCP protocol, the output format is:
45 .RS
46 .P
47 timer:(<timer_name>,<expire_time>,<retrans>)
48 .P
49 .TP
50 .B <timer_name>
51 the name of the timer, there are five kind of timer names:
52 .RS
53 .P
54 .B on
55 : means one of these timers: TCP retrans timer, TCP early retrans
56 timer and tail loss probe timer
57 .P
58 .BR keepalive ": tcp keep alive timer"
59 .P
60 .BR timewait ": timewait stage timer"
61 .P
62 .BR persist ": zero window probe timer"
63 .P
64 .BR unknown ": none of the above timers"
65 .RE
66 .TP
67 .B <expire_time>
68 how long time the timer will expire
69 .P
70 .TP
71 .B <retrans>
72 how many times the retransmission occured
73 .RE
74 .TP
75 .B \-e, \-\-extended
76 Show detailed socket information. The output format is:
77 .RS
78 .P
79 uid:<uid_number> ino:<inode_number> sk:<cookie>
80 .P
81 .TP
82 .B <uid_number>
83 the user id the socket belongs to
84 .P
85 .TP
86 .B <inode_number>
87 the socket's inode number in VFS
88 .P
89 .TP
90 .B <cookie>
91 an uuid of the socket
92 .RE
93 .TP
94 .B \-m, \-\-memory
95 Show socket memory usage. The output format is:
96 .RS
97 .P
98 skmem:(r<rmem_alloc>,rb<rcv_buf>,t<wmem_alloc>,tb<snd_buf>,
99 .br
100 .RS
101 .RS
102 f<fwd_alloc>,w<wmem_queued>,o<opt_mem>,
103 .RE
104 .RE
105 .br
106 .RS
107 .RS
108 bl<back_log>,d<sock_drop>)
109 .RE
110 .RE
111 .P
112 .TP
113 .B <rmem_alloc>
114 the memory allocated for receiving packet
115 .P
116 .TP
117 .B <rcv_buf>
118 the total memory can be allocated for receiving packet
119 .P
120 .TP
121 .B <wmem_alloc>
122 the memory used for sending packet (which has been sent to layer 3)
123 .P
124 .TP
125 .B <snd_buf>
126 the total memory can be allocated for sending packet
127 .P
128 .TP
129 .B <fwd_alloc>
130 the memory allocated by the socket as cache, but not used for
131 receiving/sending packet yet. If need memory to send/receive packet,
132 the memory in this cache will be used before allocate additional
133 memory.
134 .P
135 .TP
136 .B <wmem_queued>
137 The memory allocated for sending packet (which has not been sent to layer 3)
138 .P
139 .TP
140 .B <ropt_mem>
141 The memory used for storing socket option, e.g., the key for TCP MD5 signature
142 .P
143 .TP
144 .B <back_log>
145 The memory used for the sk backlog queue. On a process context, if the
146 process is receiving packet, and a new packet is received, it will be
147 put into the sk backlog queue, so it can be received by the process
148 immediately
149 .P
150 .TP
151 .B <sock_drop>
152 the number of packets dropped before they are de-multiplexed into the socket
153 .RE
154 .TP
155 .B \-p, \-\-processes
156 Show process using socket.
157 .TP
158 .B \-i, \-\-info
159 Show internal TCP information. Below fields may appear:
160 .RS
161 .P
162 .TP
163 .B ts
164 show string "ts" if the timestamp option is set
165 .P
166 .TP
167 .B sack
168 show string "sack" if the sack option is set
169 .P
170 .TP
171 .B ecn
172 show string "ecn" if the explicit congestion notification option is set
173 .P
174 .TP
175 .B ecnseen
176 show string "ecnseen" if the saw ecn flag is found in received packets
177 .P
178 .TP
179 .B fastopen
180 show string "fastopen" if the fastopen option is set
181 .P
182 .TP
183 .B cong_alg
184 the congestion algorithm name, the default congestion algorithm is "cubic"
185 .P
186 .TP
187 .B wscale:<snd_wscale>:<rcv_wscale>
188 if window scale option is used, this field shows the send scale factor
189 and receive scale factor
190 .P
191 .TP
192 .B rto:<icsk_rto>
193 tcp re-transmission timeout value, the unit is millisecond
194 .P
195 .TP
196 .B backoff:<icsk_backoff>
197 used for exponential backoff re-transmission, the actual
198 re-transmission timeout value is icsk_rto << icsk_backoff
199 .P
200 .TP
201 .B rtt:<rtt>/<rttvar>
202 rtt is the average round trip time, rttvar is the mean deviation of
203 rtt, their units are millisecond
204 .P
205 .TP
206 .B ato:<ato>
207 ack timeout, unit is millisecond, used for delay ack mode
208 .P
209 .TP
210 .B mss:<mss>
211 max segment size
212 .P
213 .TP
214 .B cwnd:<cwnd>
215 congestion window size
216 .P
217 .TP
218 .B pmtu:<pmtu>
219 path MTU value
220 .P
221 .TP
222 .B ssthresh:<ssthresh>
223 tcp congestion window slow start threshold
224 .P
225 .TP
226 .B bytes_acked:<bytes_acked>
227 bytes acked
228 .P
229 .TP
230 .B bytes_received:<bytes_received>
231 bytes received
232 .P
233 .TP
234 .B segs_out:<segs_out>
235 segments sent out
236 .P
237 .TP
238 .B segs_in:<segs_in>
239 segments received
240 .P
241 .TP
242 .B send <send_bps>bps
243 egress bps
244 .P
245 .TP
246 .B lastsnd:<lastsnd>
247 how long time since the last packet sent, the unit is millisecond
248 .P
249 .TP
250 .B lastrcv:<lastrcv>
251 how long time since the last packet received, the unit is millisecond
252 .P
253 .TP
254 .B lastack:<lastack>
255 how long time since the last ack received, the unit is millisecond
256 .P
257 .TP
258 .B pacing_rate <pacing_rate>bps/<max_pacing_rate>bps
259 the pacing rate and max pacing rate
260 .P
261 .TP
262 .B rcv_space:<rcv_space>
263 a helper variable for TCP internal auto tuning socket receive buffer
264 .RE
265 .TP
266 .B \-\-tos
267 Show ToS and priority information. Below fields may appear:
268 .RS
269 .P
270 .TP
271 .B tos
272 IPv4 Type-of-Service byte
273 .P
274 .TP
275 .B tclass
276 IPv6 Traffic Class byte
277 .P
278 .TP
279 .B class_id
280 Class id set by net_cls cgroup. If class is zero this shows priority
281 set by SO_PRIORITY.
282 .RE
283 .TP
284 .B \-K, \-\-kill
285 Attempts to forcibly close sockets. This option displays sockets that are
286 successfully closed and silently skips sockets that the kernel does not support
287 closing. It supports IPv4 and IPv6 sockets only.
288 .TP
289 .B \-s, \-\-summary
290 Print summary statistics. This option does not parse socket lists obtaining
291 summary from various sources. It is useful when amount of sockets is so huge
292 that parsing /proc/net/tcp is painful.
293 .TP
294 .B \-E, \-\-events
295 Continually display sockets as they are destroyed
296 .TP
297 .B \-Z, \-\-context
298 As the
299 .B \-p
300 option but also shows process security context.
301 .sp
302 For
303 .BR netlink (7)
304 sockets the initiating process context is displayed as follows:
305 .RS
306 .RS
307 .IP "1." 4
308 If valid pid show the process context.
309 .IP "2." 4
310 If destination is kernel (pid = 0) show kernel initial context.
311 .IP "3." 4
312 If a unique identifier has been allocated by the kernel or netlink user,
313 show context as "unavailable". This will generally indicate that a
314 process has more than one netlink socket active.
315 .RE
316 .RE
317 .TP
318 .B \-z, \-\-contexts
319 As the
320 .B \-Z
321 option but also shows the socket context. The socket context is
322 taken from the associated inode and is not the actual socket
323 context held by the kernel. Sockets are typically labeled with the
324 context of the creating process, however the context shown will reflect
325 any policy role, type and/or range transition rules applied,
326 and is therefore a useful reference.
327 .TP
328 .B \-N NSNAME, \-\-net=NSNAME
329 Switch to the specified network namespace name.
330 .TP
331 .B \-b, \-\-bpf
332 Show socket BPF filters (only administrators are allowed to get these
333 information).
334 .TP
335 .B \-4, \-\-ipv4
336 Display only IP version 4 sockets (alias for -f inet).
337 .TP
338 .B \-6, \-\-ipv6
339 Display only IP version 6 sockets (alias for -f inet6).
340 .TP
341 .B \-0, \-\-packet
342 Display PACKET sockets (alias for -f link).
343 .TP
344 .B \-t, \-\-tcp
345 Display TCP sockets.
346 .TP
347 .B \-u, \-\-udp
348 Display UDP sockets.
349 .TP
350 .B \-d, \-\-dccp
351 Display DCCP sockets.
352 .TP
353 .B \-w, \-\-raw
354 Display RAW sockets.
355 .TP
356 .B \-x, \-\-unix
357 Display Unix domain sockets (alias for -f unix).
358 .TP
359 .B \-S, \-\-sctp
360 Display SCTP sockets.
361 .TP
362 .B \-\-vsock
363 Display vsock sockets (alias for -f vsock).
364 .TP
365 .B \-\-xdp
366 Display XDP sockets (alias for -f xdp).
367 .TP
368 .B \-f FAMILY, \-\-family=FAMILY
369 Display sockets of type FAMILY. Currently the following families are
370 supported: unix, inet, inet6, link, netlink, vsock, xdp.
371 .TP
372 .B \-A QUERY, \-\-query=QUERY, \-\-socket=QUERY
373 List of socket tables to dump, separated by commas. The following identifiers
374 are understood: all, inet, tcp, udp, raw, unix, packet, netlink, unix_dgram,
375 unix_stream, unix_seqpacket, packet_raw, packet_dgram, dccp, sctp,
376 vsock_stream, vsock_dgram, xdp Any item in the list may optionally be
377 prefixed by an exclamation mark
378 .RB ( ! )
379 to exclude that socket table from being dumped.
380 .TP
381 .B \-D FILE, \-\-diag=FILE
382 Do not display anything, just dump raw information about TCP sockets
383 to FILE after applying filters. If FILE is - stdout is used.
384 .TP
385 .B \-F FILE, \-\-filter=FILE
386 Read filter information from FILE. Each line of FILE is interpreted
387 like single command line option. If FILE is - stdin is used.
388 .TP
389 .B FILTER := [ state STATE-FILTER ] [ EXPRESSION ]
390 Please take a look at the official documentation for details regarding filters.
391
392 .SH STATE-FILTER
393
394 .B STATE-FILTER
395 allows to construct arbitrary set of states to match. Its syntax is
396 sequence of keywords state and exclude followed by identifier of
397 state.
398 .TP
399 Available identifiers are:
400
401 All standard TCP states:
402 .BR established ", " syn-sent ", " syn-recv ", " fin-wait-1 ", " fin-wait-2 ", " time-wait ", " closed ", " close-wait ", " last-ack ", "
403 .BR listening " and " closing.
404
405 .B all
406 - for all the states
407
408 .B connected
409 - all the states except for
410 .BR listening " and " closed
411
412 .B synchronized
413 - all the
414 .B connected
415 states except for
416 .B syn-sent
417
418 .B bucket
419 - states, which are maintained as minisockets, i.e.
420 .BR time-wait " and " syn-recv
421
422 .B big
423 - opposite to
424 .B bucket
425
426 .SH USAGE EXAMPLES
427 .TP
428 .B ss -t -a
429 Display all TCP sockets.
430 .TP
431 .B ss -t -a -Z
432 Display all TCP sockets with process SELinux security contexts.
433 .TP
434 .B ss -u -a
435 Display all UDP sockets.
436 .TP
437 .B ss -o state established '( dport = :ssh or sport = :ssh )'
438 Display all established ssh connections.
439 .TP
440 .B ss -x src /tmp/.X11-unix/*
441 Find all local processes connected to X server.
442 .TP
443 .B ss -o state fin-wait-1 '( sport = :http or sport = :https )' dst 193.233.7/24
444 List all the tcp sockets in state FIN-WAIT-1 for our apache to network
445 193.233.7/24 and look at their timers.
446 .TP
447 .B ss -a -A 'all,!tcp'
448 List sockets in all states from all socket tables but TCP.
449 .SH SEE ALSO
450 .BR ip (8),
451 .br
452 .BR RFC " 793 "
453 - https://tools.ietf.org/rfc/rfc793.txt (TCP states)
454
455 .SH AUTHOR
456 .I ss
457 was written by Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>.
458 .PP
459 This manual page was written by Michael Prokop <mika@grml.org>
460 for the Debian project (but may be used by others).