netstat
Display network connections, routing tables, and interface statistics (legacy, prefer ss).
Synopsis
netstat [OPTION]...
Examples
netstat -tlnp
netstat -an
netstat -rn
netstat -s
Common options
| Flag | Description |
|---|---|
| -t | Show TCP connections |
| -u | Show UDP connections |
| -l | Show listening sockets |
| -n | Numeric addresses and ports |
| -p | Show process using socket |
| -a | Show all sockets |
About netstat
The `netstat` command display network connections, routing tables, and interface statistics (legacy, prefer ss). Networking commands handle connectivity testing, DNS resolution, data transfer, remote access, firewall rules, and traffic analysis.
Linux is the dominant server operating system, and strong networking skills are essential for web hosting, container orchestration, security auditing, and infrastructure management. The command accepts 6 commonly used flags shown above, though the full set of options is available in the man page (`man netstat`).
The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Network Commands
Other commands in the Network category