netstat Cheat Sheet

The classic network statistics tool — sockets, routes, and interfaces on legacy systems still running it.

Networking2 sections · 9 commands
⌘K

Sockets

5
netstat -tulpn

Listening TCP/UDP with PID/program

netstat -an

All sockets, numeric, no resolve

netstat -tnp | grep :80

Active TCP on a port

netstat -ta

TCP with states (listening+established)

netstat -an | awk '{print $6}' | sort | uniq -c

Connection counts by state

Routes & Interfaces

4
netstat -rn

Routing table, numeric

netstat -i

Interface stats (errors, drops)

netstat -s

Protocol statistics

netstat -st

TCP statistics only