Skip to content
# Networking

Checking open ports & connections

List listening ports and active connections with ss (and lsof for per-process detail).

ss is the modern netstat

netstat still works on most distros but is considered legacy; ss (from iproute2, same package as the ip command) is faster and is what you'll find preinstalled everywhere modern, including minimal images.

List listening ports

-t (TCP), -u (UDP), -l (listening only), -n (numeric ports instead of service names), -p (show the owning process β€” needs sudo).

bash
sudo ss -tulpn

Check one specific port

Useful to confirm whether something is actually listening before chasing a firewall rule.

bash
sudo ss -tulpn | grep :443

All established connections

Shows active connections, not just listening sockets β€” handy for spotting an unexpected outbound connection.

bash
ss -tn state established

lsof: which process has this port or file open

lsof ("list open files" β€” sockets count as files on Linux) gives another angle, especially useful when you know the port but ss's process name is truncated.

bash
sudo lsof -i :443
sudo apt install lsof   # if not already installed