# Created on savesnippets.com · https://savesnippets.com/IojR9rgyTdvCVw # All TCP listening sockets + the process holding them (needs root for process info) sudo ss -tlnp # UDP listeners sudo ss -ulnp # Both, summarized ss -s # Count active connections by state ss -tn state established | wc -l # Find what holds a specific port (alternatives — pick by availability) sudo ss -tlnp 'sport = :8080' sudo lsof -i :8080 sudo fuser 8080/tcp # Legacy netstat — works but deprecated sudo netstat -tlnp 2>/dev/null