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