Category: Advanced – Command Line • Est. reading time: 1 minute
The netstat command shows network connections, listening ports, and network statistics. One heads-up: netstat is now considered obsolete on modern Linux, and the faster ss command has replaced it. ss takes the same style of options, so both are shown below.
Show all sockets
netstat -a
ss -a # modern equivalent
Show only TCP or UDP
netstat -at # TCP
netstat -au # UDP
Show only listening sockets
netstat -l
netstat -lt # TCP, listening only
Listening TCP and UDP, with program names, IPs, and ports
netstat -tulpen
ss -tulpen # the same options work with ss
The letters mean: t TCP, u UDP, l listening, p program and PID, e extended info, n numeric (skip name lookups). Add sudo to see the program name for sockets you do not own.
Running your own dedicated or self-managed server? We are glad to help. Reach us at support@allydrez.com or 1-321-209-2004.