• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Linux Tutorials Networking

Linux Networking: netstat (Network Statistics) Examples on Linux

neo by neo
May 27, 2025
in Networking
0
netstat example on Ubuntu

netstat example on Ubuntu

0
SHARES
5
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

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:

ADVERTISEMENT
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.

ADVERTISEMENT

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

ADVERTISEMENT

defencedev.com

About The Author

neo

See author's posts

ADVERTISEMENT
Previous Post

Network Monitoring (Bandwidth, Sessions) Tools for Linux

Next Post

Lesson 1: Introduction to Bash Scripting

neo

neo

Related Posts

Linux Networking: Display Open Ports and Listening Services
Networking

Linux Networking: Display Open Ports and Listening Services

Linux Networking: route, Mastering Routing in Ubuntu
Networking

Linux Networking: route, Mastering Routing in Ubuntu

Linux Networking: ping, Troubleshooting Network Connectivity
Networking

Linux Networking: ping, Troubleshooting Network Connectivity

Linux Networking: Add Multiple Network Gateways (Redundancy) on Ubuntu with netplan
Networking

Linux Networking: Add Multiple Network Gateways (Redundancy) on Ubuntu with netplan

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu
Networking

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu

Linux Networking: Add VLAN on Ubuntu with netplan
Networking

Linux Networking: Add VLAN on Ubuntu with netplan

Next Post
Lesson 1: Introduction to Bash Scripting

Lesson 1: Introduction to Bash Scripting

Recommended

Fortinet FortiGate: QoS, Traffic Shapers and Bandwidth Limitation

Fortinet FortiGate: QoS, Traffic Shapers and Bandwidth Limitation

MikroTik: Check Your Wireless Password

MikroTik: Check Your Wireless Password

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

Raspberry Pi Monitoring with Monit: Docker, Temperature, Network & More

Raspberry Pi Monitoring with Monit: Docker, Temperature & More

ADVERTISEMENT

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

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

FortiGate DDoS Protection: Configure DoS Policies to Secure Self-Hosted Applications

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

Fortinet FortiGate Site-to-Site IPsec VPN Troubleshooting

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

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.