Network and remote access

Command ss

Show network connections and ports

Linux · Bash examples · commands run on the selected server

When to use ss

Use ss to inspect socket state and listening addresses on the Linux server. A service listening on loopback is different from one exposed on a network interface, and local listening does not override firewall rules.

Syntax

ss [OPTIONS] [FILTER]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-l
Listening sockets only.
-t / -u
TCP or UDP.
-n / -p
Numeric addresses and ports/process information.

Usage examples

Show listening TCP ports

ss -ltn

Listening TCP sockets are displayed numerically.

View listening sockets and processes

sudo ss -lntup

Listening TCP and UDP sockets include process information where privileges permit.

Check connections to HTTPS

ss -tn 'dport = :443'

Non-listening TCP sockets are filtered by the selected destination port.

Notes and limitations

  • Information about other people's processes may require administrator permissions.
  • Having a listening socket does not guarantee reachability through firewall or from another network.

Common questions and troubleshooting

Why is a listening port unreachable from outside?

The bind address, host firewall, network firewall, routing or address translation can block external access. Inspect each relevant layer.

Why are process names missing?

Process association can require elevated visibility or be limited by system policy. Missing ownership details do not mean the socket has no owner.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man ss.