Network

netstat

Display network connections, routing tables, and interface statistics (legacy, prefer ss).

Synopsis

syntax
netstat [OPTION]...

Examples

Show TCP listening ports with processes
netstat -tlnp
Show all connections numerically
netstat -an
Show routing table
netstat -rn
Show protocol statistics
netstat -s

Common options

FlagDescription
-tShow TCP connections
-uShow UDP connections
-lShow listening sockets
-nNumeric addresses and ports
-pShow process using socket
-aShow 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

Related tools