Problem Statement
What does netstat -tuln show?
Explanation
Netstat displays network connections, routing tables, interface statistics, and more. The flags -tuln show: -t (TCP connections), -u (UDP connections), -l (listening ports only), -n (numeric output without hostname resolution, faster). This combination shows all services listening for network connections, useful for security audits and troubleshooting.
Output shows protocol (tcp/udp), local address:port (0.0.0.0:80 means listening on all interfaces), foreign address (connections from), and state (LISTEN, ESTABLISHED, TIME_WAIT). Example: 0.0.0.0:22 in LISTEN state indicates SSH server listening on all interfaces port 22.
Netstat is being replaced by ss (socket statistics) command which is faster and provides more detailed information: ss -tuln gives same output but performs better on busy systems. Both commands are essential for identifying which services are running, detecting unauthorized services, verifying firewall rules, and troubleshooting network services that won't start due to port conflicts.
