2014-02-26 16:51:09 +00:00
|
|
|
# ss
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Utility to investigate sockets.
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Dump all TCP/UDP/RAW/UNIX sockets:
|
2014-02-26 16:51:09 +00:00
|
|
|
|
|
|
|
`ss -a {{-t/-u/-w/-x}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Show process(es) that using socket:
|
2014-02-27 12:51:25 +00:00
|
|
|
|
|
|
|
`ss -p`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Filter TCP sockets by states, only/exclude:
|
2014-02-26 16:51:09 +00:00
|
|
|
|
|
|
|
`ss {{state/exclude}} {{bucket/big/connected/synchronized/...}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Filter sockets by address and/or port:
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2014-02-27 12:51:25 +00:00
|
|
|
`ss -t dst 1.2.3.4:80`
|
|
|
|
`ss -u src 127/8`
|
|
|
|
`ss -t 'dport >= :1024'`
|
|
|
|
`ss -x "src /tmp/.X11-unix/*"`
|
|
|
|
`ss -t state established '( dport = :ssh or sport = :ssh )'`
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Only list IPv4 or IPv6 sockets:
|
2014-02-26 16:51:09 +00:00
|
|
|
|
|
|
|
`ss {{-4/-6}}`
|