netstat

>Usage

The netstat command displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. It can help you monitor your system's network performance and troubleshoot issues.

>Synopsis

netstat [option]

>Options

-a

This option displays all active connections, both established and listening. By default, netstat only shows established connections. This option is useful for seeing the full scope of network activity, including listening ports that are waiting for incoming connections.

For example, using netstat -a will show all connections, including services that are listening for connections, such as web servers and SSH services.

Example:

Dots

-a

> netstat -a


Active Internet connections (servers and established)

-t

This is useful when you're troubleshooting or monitoring TCP traffic specifically, such as HTTP or FTP connections.
TCP connections are typically more stable and reliable than UDP connections, as TCP includes error checking and guarantees packet delivery. With this option, you can see the state of all active TCP connections, including those in the LISTEN state, indicating that a service is waiting for incoming connections.

Example:

Dots

-t

> netstat -t


Active TCP connections

-u

This option filters the output to show only UDP connections. Unlike TCP, UDP does not establish a reliable connection between devices and does not guarantee the delivery of packets. It is often used in applications where speed is more critical than reliability, such as video streaming or DNS requests.

Using this option will allow you to monitor UDP traffic, which is often used for real-time communication and services that require low latency. You can use netstat -u to view all active UDP connections, such as DNS or NTP traffic.

Example:

Dots

-u

> netstat -u


Active UDP connections

>Quiz

Progress: Question ? out of ?

The dig command can be used to query DNS records.

Page written by Selcan Kaya