Using netstat to Inspect Connections

What netstat Shows You

While ping and traceroute investigate connectivity to a remote destination, netstat looks inward - showing all the active network connections and listening ports on your own local device right now.

$ netstat -an

Proto  Local Address        Foreign Address       State
TCP    192.168.1.10:51000   93.184.216.34:443     ESTABLISHED
TCP    0.0.0.0:80           0.0.0.0:0             LISTENING
UDP    0.0.0.0:53           *:*

Understanding Connection States

StateMeaning
LISTENINGA service is running and waiting for incoming connections on this port
ESTABLISHEDAn active, currently open connection to a remote address
TIME_WAITA connection that recently closed, still briefly held before fully clearing

Checking What's Actually Running on This Device

Seeing which ports are in a LISTENING state reveals exactly which services are currently active and reachable on a device - useful both for legitimate troubleshooting (confirming a web server is actually running) and for basic security auditing (spotting an unexpected, unrecognized service listening that shouldn't be there).

Diagnosing "Why Won't This Connect?"

If an application is failing to connect and netstat shows no LISTENING entry for the expected port at all, that's an immediate, strong clue: the service itself likely isn't running, rather than the problem being anywhere in the network path between the two devices.

Modern Alternatives on Some Systems

On several modern operating systems, netstat has been effectively replaced by newer tools offering similar (and often more detailed) information - though the underlying concept of inspecting local connections and listening ports remains exactly the same regardless of which specific tool is used.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.