• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Linux
    • Bash Scripting
      • Bash Scripting Lessons
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Tools
No Result
View All Result
  • Home
  • Linux
    • Bash Scripting
      • Bash Scripting Lessons
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Tools
No Result
View All Result
DefenceDev
No Result
View All Result
Home Linux Commands&Tips

Linux Networking: netstat (Network Statistics) Examples on Linux

by neo
September 3, 2026
in Commands&Tips
0
netstat example on Ubuntu

netstat example on Ubuntu

0
SHARES
30
VIEWS
Share on FacebookShare on LinkedIn

Linux Networking: Network Statistics Examples on Linux

Monitoring network activity is a crucial part of managing Linux systems, whether for performance tuning or troubleshooting connectivity issues. In this article, we’ll explore various examples and commands to check network statistics on Linux, providing insights into traffic, bandwidth, and connections to help you stay in control of your network.

Introduction

The netstat (Network Statistics) command is a powerful network utility available on Linux that provides a variety of network-related information. This tool is essential for network administrators and users who need to monitor and troubleshoot network connections.

Prerequisites

  • Sudo Privileges
    • You should have a user account with administrative (sudo) privileges. Certain options in netstat may require elevated permissions.
  • Install netstat Utility
    • The netstat command is part of the net-tools package, which is not pre-installed in modern Ubuntu versions. Install it with the following commands:
sudo apt update
sudo apt install net-tools

Display Active Connections

The netstat command provides details about the network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. Here’s an explanation of a typical output section:

netstat
Output:
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp6       0     64 nginx:ssh               _gateway:62720          ESTABLISHED
Active UNIX domain sockets (w/o servers)
Breakdown of the Output
  • Proto: The protocol (e.g., tcp, udp, or tcp6 for IPv6).
  • Recv-Q: The number of bytes not yet copied by the receiving process.
  • Send-Q: The number of bytes not yet acknowledged by the remote host.
  • Local Address: The local address and port number (e.g., 192.168.10.10:22).
  • Foreign Address: The remote address and port number (e.g., 192.168.34.22:54124).
  • State: The connection state (e.g., ESTABLISHED, LISTEN, CLOSE_WAIT).
  • PID/Program name: The PID and program name associated with the socket.

Show Network Interfaces

The netstat -i command shows a list of network interfaces and their statistics.

netstat -i
Example of netstat -i on Ubuntu
Example of netstat -i on Ubuntu
Output:
Kernel Interface table
Iface             MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
enp0s3           1500     1695      0      0 0           449      0      0      0 BMRU
lo              65536      142      0      0 0           142      0      0      0 LRU

Display Routing Table

The netstat -r command displays the kernel’s routing table, providing information about how data is routed through the network. Below is an example output and explanation of its components:

netstat -r

Output:

Example of netstat -r on Ubuntu
Example of netstat -r on Ubuntu

Display Listening Ports

The netstat -l command shows all the currently listening ports on the system. It provides details about services waiting for incoming connections.

netstat -l
Example of netstat -l on Ubuntu
Example of netstat -l on Ubuntu

This command lists all listening ports. For a detailed view, including TCP and UDP ports, use:

netstat -ltu
Example of netstat -ltu on Ubuntu
Example of netstat -ltu on Ubuntu

Show Network Statistics

The netstat -s command provides a summary of statistics for various network protocols. It breaks down data for TCP, UDP, ICMP, IP, and more.

netstat -s

Example of netstat -s on Ubuntu
Example of netstat -s on Ubuntu

Find a Specific Port

netstat -an | grep <port_number>
Example of netstat -an | grep 0.0.0.0:22" on Ubuntu
Example of netstat -an | grep 0.0.0.0:22″ on Ubuntu

Viewing Listening Services

netstat -tuln
Example of netstat -tuln on Ubuntu
Example of netstat -tuln on Ubuntu

This command lists all the listening services along with their respective ports in numeric form.

More examples how to use netstat command you can find at the link.

defencedev.com

Tags: linuxmonitoringnetworking
Previous Post

Best Linux Network Monitoring Tools for Bandwidth and Sessions

Next Post

Lesson 1: Introduction to Bash Scripting

neo

Related Posts

10+ Useful Linux find Command Examples You Should Know
Commands&Tips

10+ Useful Linux find Command Examples You Should Know

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)
Commands&Tips

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)

Timeshift on Linux: How to Create and Restore System Snapshots
Commands&Tips

Timeshift on Linux: How to Create and Restore System Snapshots

Remote Desktop Access to Ubuntu 24.04 from Windows
Commands&Tips

Remote Desktop Access to Ubuntu 24.04 from Windows

Fix "blk_update_request: critical target error" on Ubuntu Server (dev sdb, DISCARD Operation)
Commands&Tips

Fix “blk_update_request: critical target error” on Ubuntu Server with SSD (dev sdb, DISCARD Operation)

Passwordless SSH Login on Ubuntu: Secure Server Access
Commands&Tips

Passwordless SSH Login on Ubuntu: Secure Server Access

Next Post
Lesson 1: Introduction to Bash Scripting

Lesson 1: Introduction to Bash Scripting

Recommended

MikroTik: Reset to Factory Settings with Terminal CLI

MikroTik: Reset to Factory Settings with Terminal CLI

Fortinet FortiGate Upgrade Path Tool

Fortinet FortiGate Upgrade Path Tool

Briefly unavailable for scheduled maintenance. Check back in a minute.

WordPress Stuck in Maintenance Mode After Plugin Update

Promox Telegram Alert Example

Configure Telegram Notifications in Proxmox VE Using Webhooks

Fix Proxmox VM Snapshot “Out of Space” Errors

Fix Proxmox VM Snapshot “Out of Space” Errors

Categories

  • Linux
    • Bash Scripting
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Web Tools

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

Briefly unavailable for scheduled maintenance. Check back in a minute.

WordPress Stuck in Maintenance Mode After Plugin Update

Promox Telegram Alert Example

Configure Telegram Notifications in Proxmox VE Using Webhooks

  • Site Map
  • Privacy Policy
  • Facebook Page
  • GitHub
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Linux
    • Bash Scripting
      • Bash Scripting Lessons
    • Commands&Tips
    • Monitoring
  • Networking
    • FortiGate
    • MikroTik
  • Projects & Case Studies
  • Self-Hosted
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Virtualization
    • Proxmox
    • VMware
  • Tools

© 2025 defencedev.com - All rights reserved.