Linux networking cheatsheet

Linux networking: Ports and connections

6 common Linux networking tasks.

List listening ports

Show listening TCP and UDP sockets and the processes that own them.

sudo ss -tulpn

Find what is using a port

Show the socket and process for a port.

sudo ss -ltnp 'sport = :8080'

Show established connections

List established TCP connections.

ss -tn state established

Summarize socket counts

Show totals by socket state.

ss -s

List processes using a port

Show the process that has a port open.

sudo lsof -i :8080

Scan a host's open ports

List open ports on a host. Only scan systems you own or have permission to test.

nmap -sV -p 1-1024 192.168.1.10

Caution: Scanning networks you don't control may be illegal or break policy.

Was this page helpful?