2014-02-26 16:51:09 +00:00
|
|
|
# ss
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Utility to investigate sockets.
|
2021-04-07 01:14:32 +01:00
|
|
|
> More information: <https://manned.org/ss.8>.
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2016-01-24 15:45:44 +00:00
|
|
|
- Show all TCP/UDP/RAW/UNIX sockets:
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2016-01-25 09:52:05 +00:00
|
|
|
`ss -a {{-t|-u|-w|-x}}`
|
2014-02-26 16:51:09 +00:00
|
|
|
|
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-24 17:02:53 +00:00
|
|
|
- Show all TCP sockets connected to the local HTTPS port (443):
|
2016-01-24 15:45:44 +00:00
|
|
|
|
|
|
|
`ss -t src :{{443}}`
|
|
|
|
|
2019-04-19 21:00:53 +01:00
|
|
|
- Show all TCP sockets listening on the local 8080 port:
|
|
|
|
|
|
|
|
`ss -lt src :{{8080}}`
|
|
|
|
|
2016-01-24 15:45:44 +00:00
|
|
|
- Show all TCP sockets along with processes connected to a remote ssh port:
|
|
|
|
|
|
|
|
`ss -pt dst :{{ssh}}`
|
|
|
|
|
2016-01-24 17:02:53 +00:00
|
|
|
- Show all UDP sockets connected on specific source and destination ports:
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2016-01-24 17:02:53 +00:00
|
|
|
`ss -u 'sport == :{{source_port}} and dport == :{{destination_port}}'`
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2016-01-24 15:45:44 +00:00
|
|
|
- Show all TCP IPv4 sockets locally connected on the subnet 192.168.0.0/16:
|
2014-02-26 16:51:09 +00:00
|
|
|
|
2016-01-24 17:02:53 +00:00
|
|
|
`ss -4t src {{192.168/16}}`
|
2022-12-29 23:25:39 +00:00
|
|
|
|
|
|
|
- Kill IPv4 or IPv6 Socket Connection with destination IP 192.168.1.17 and destination port 8080:
|
|
|
|
|
|
|
|
`ss --kill dst {{192.168.1.17}} dport = {{8080}}`
|