How to use the SSH netstat command
The SSH netstat command displays network connections, routing tables, and socket statistics on your Linux server. In particular, it’s useful for debugging connection issues, checking which ports are listening, and tracking network activity. Furthermore, netstat helps you see TCP and UDP connections, identify processes using specific ports, and troubleshoot firewall or service problems on a VPS or dedicated server via SSH. Note: on some modern Linux systems, ss is the preferred alternative; netstat may require installing the net-tools package.
Display all sockets (TCP and UDP)
To show all active connections and listening sockets:
netstat -aThis lists TCP and UDP connections, both established and listening. Output can be long on busy servers.
Display specific protocols
To show only TCP connections:
netstat -atTo show only UDP:
netstat -auDisplay listening ports
To show only ports that are listening for connections:
netstat -lFor TCP listening ports only:
netstat -ltUseful for verifying that web server (80, 443), SSH (22), or other services are bound correctly.
Display listening ports with process and numeric output
To see listening TCP and UDP ports with port numbers (not service names) and the process using each port:
netstat -tulnpThe flags mean: -t TCP, -u UDP, -l listening, -n numeric (no DNS lookup), -p show process. Requires root to see process names for other users’ connections. This is one of the most useful combinations for troubleshooting.
Modern alternative: ss command
On many Linux distributions, ss replaces netstat and is faster. Equivalent commands: ss -tulnp for listening ports with processes, ss -at for TCP connections. Use ss if netstat is not installed or for better performance on busy servers.
Common use cases
Typical uses for SSH netstat command on a Linux hosting account:
- Checking if a web server or database is listening on the expected port
- Identifying which process is using a port (e.g. port 80 or 443)
- Debugging connection refused or port already in use errors
- Monitoring active connections for security or performance
For viewing running processes, see the SSH ps command. For firewall rules, check your hosting control panel or iptables documentation.
Need more help?
Explore more SSH and hosting guides in our knowledgebase. JetHost web hosting includes SSH access for managing your server and troubleshooting network issues.


