The netstat Command
Displays network connections, routing tables, interface stats, and open ports.
- Interface stats:
netstat -i - Shows RX/TX packets and errors.
- TX-ERR high → possible network issues.

-
Routing table:
netstat -r -
Similar to
route; shows where packets are sent.

-
Open ports (listening services):
netstat -tln -
-t→ TCP,-l→ listening,-n→ numeric addresses. - Example: port #22 is listening, which means it is open.

- Show names instead of numbers:
netstat -tl

-
Notes:
-
netstatis obsolete in many distributions. -
Replacements:
ss→ network connectionsip route→ routing tableip -s link→ interface statsip maddr→ multicast addresses