Privacy Policy
© 2025 linux101.dev

netstat Command

The netstat (network statistics) command displays network connections, routing tables, and various network interface statistics. Note: On modern Linux systems, netstat is considered obsolete and has been replaced by the faster and more powerful ss command. However, it is still found on many systems.

Common `netstat` Commands

List Listening Ports

netstat -tuln

This is one of the most common uses. It displays all listening TCP and UDP ports without resolving hostnames.

Flag breakdown:
  • -t → TCP ports.
  • -u → UDP ports.
  • -l → Listening ports only.
  • -n → Numeric addresses (don't resolve names).

Show Process Info

netstat -tulnp

Adds the PID (Process ID) and name of the program to which each socket belongs. Requires root privileges to see all process names.

Show Routing Table

netstat -r

Displays the kernel routing table. The same information can be obtained with ip route.

Show Interface Statistics

netstat -i

Shows a table of all network interfaces and statistics like transmitted/received packets. The equivalent ip command is ip -s link.