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