Skip to content

Linux netstat Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux netstat Guide

Complete beginner-friendly guide to netstat on Linux, covering Arch Linux, CachyOS, and other distributions including network connections, listening ports, and network statistics.


Table of Contents

  1. netstat Installation
  2. netstat Basics
  3. Viewing Connections
  4. Network Statistics
  5. Troubleshooting

netstat Installation

Install netstat

Arch/CachyOS:

# Install net-tools (includes netstat)
sudo pacman -S net-tools

# Note: ss is modern replacement

Debian/Ubuntu:

sudo apt install net-tools

Fedora:

sudo dnf install net-tools

Verify Installation

Check netstat:

# Check version
netstat --version

# Check help
netstat --help

netstat Basics

List Connections

View connections:

# List all connections
netstat -a

# List TCP connections
netstat -at

# List UDP connections
netstat -au

Listening Ports

View listeners:

# List listening ports
netstat -l

# TCP listeners
netstat -lt

# UDP listeners
netstat -lu

Viewing Connections

Established Connections

Active connections:

# Established connections
netstat -tn

# With process info
netstat -tnp

# Show hostnames
netstat -tn

Connection States

Filter by state:

# Listening
netstat -ln

# Established
netstat -tn | grep ESTABLISHED

# All states
netstat -a

Network Statistics

Interface Statistics

Network stats:

# Interface statistics
netstat -i

# Extended stats
netstat -ie

# Statistics by protocol
netstat -s

Routing Table

View routes:

# Routing table
netstat -r

# With hostnames
netstat -rn

Troubleshooting

netstat Not Found

Install net-tools:

# Install net-tools
sudo pacman -S net-tools

# Or use ss (modern replacement)
ss -tuln

Summary

This guide covered netstat installation, network connection viewing, and statistics for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally