2017-05-26 06:14:21 +00:00
|
|
|
# Utility to investigate sockets
|
|
|
|
#
|
|
|
|
# Options:
|
|
|
|
# -4/-6 list ipv4/ipv6 sockets
|
|
|
|
# -n numeric addresses instead of hostnames
|
2017-05-26 06:17:36 +00:00
|
|
|
# -l list listening sockets
|
2017-05-26 06:14:21 +00:00
|
|
|
# -u/-t/-x list udp/tcp/unix sockets
|
|
|
|
# -p Show process(es) that using socket
|
|
|
|
|
|
|
|
# show all listening tcp sockets including the corresponding process
|
|
|
|
ss -tlp
|
|
|
|
|
|
|
|
# show all sockets connecting to 192.168.2.1 on port 80
|
|
|
|
ss -t dst 192.168.2.1:80
|
|
|
|
|
|
|
|
# show all ssh related connection
|
2018-07-17 09:42:16 +00:00
|
|
|
# documentation on the filter syntax: sudo apt-get install iproute2-doc
|
2017-05-26 06:14:21 +00:00
|
|
|
ss -t state established '( dport = :ssh or sport = :ssh )'
|
|
|
|
|
|
|
|
# Display timer information
|
|
|
|
ss -tn -o
|
|
|
|
|
|
|
|
# Filtering connections by tcp state
|
|
|
|
ss -t4 state established
|
|
|
|
|