Skip to main content

List open sockets and ports.

# To show listening sockets:
sockstat -l

# To show listening sockets for IPv4 only:
sockstat -4 -l

# To show listening sockets for IPv6 only:
sockstat -6 -l

# To determine if port '22' (default ssh port) is listening:
sockstat -4 -l | grep :22

# To show only 'connected' IPv4 ports/sockets on port '22' (default ssh port):
sockstat -c -4 | grep 22