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).
sudo ss -tulpnCheck one specific port
Useful to confirm whether something is actually listening before chasing a firewall rule.
sudo ss -tulpn | grep :443All established connections
Shows active connections, not just listening sockets β handy for spotting an unexpected outbound connection.
ss -tn state establishedlsof: 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.
sudo lsof -i :443
sudo apt install lsof # if not already installed