Tools & Commands · Linux and Windows Commands
netstat
Sockets · Intermediate
A long-standing command that lists connections, listening ports, and routing information. On current Linux systems, ss is the usual replacement.
It answers which ports are listening and which remote addresses are connected. The flags change the view. Many administrators now use a newer socket utility on Linux.
Example: netstat -an shows addresses and ports numerically, including listeners and established connections.
Command
Platform: Windows and many Unix-like systems
netstat -an
LISTENING or LISTEN means a local port is waiting. ESTABLISHED means a connection exists. Numeric mode avoids name lookups that slow the output.
Common misconception
- Seeing a listening port does not tell you the business purpose of the program. It tells you a socket exists.