This article is a mirror article of machine translation, please click here to jump to the original article.

View: 1348|Reply: 0

[Communication] Linux View Network Bandwidth Usage (Real-time Traffic)

[Copy link]
Posted on 2025-3-13 10:13:48 | | | |
Linux offers a variety of tools for monitoring network traffic and bandwidth usage. These tools help you maintain a stable network, pinpoint the cause of slow speeds, and fix faults quickly.

You can monitor network bandwidth usage on Linux systems using command-line (CLI) or graphical user interface (GUI) tools.

Command-line network monitoring tools are ideal for Linux servers without a graphical interface. With a few simple commands, users can quickly get an overview of network bandwidth metrics directly in the terminal shell. Administrators often use these tools in scripts to automate monitoring tasks, track changes in real-time, and reduce response times.

GUI tools typically visually organize and present network data in the form of graphs and charts. This simplifies the process of monitoring network bandwidth and performance, even for users with limited technical experience. Users who run analytics or other tasks that require a detailed representation of network usage will work more efficiently using GUI tools.

Command Line Linux Network Monitoring Tools, this section lists the most commonly used Linux CLI tools for monitoring network traffic and bandwidth.

iftop - Shows bandwidth usage

iftop displays the bandwidth usage of each connection in real-time and provides an overview of the total bandwidth usage. This utility is also very useful for checking network speed.

iftop does not store historical data or track traffic by process ID (PID), which can be a significant drawback for many users. To install iftop, use the command associated with your distribution:

Linux distributionsiftop installation command
Debian/Ubuntusudo apt install iftop
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install iftop -y
Fedorasudo dnf install iftop -y
Arch Linuxsudo pacman -S iftop
OpenSUSEsudo zypper install iftop

To start iftop, enter the following command:




Press Q to exit IFTOP and return to the command prompt.

nload – Shows network usage

nload is a command-line utility that reports inbound and outbound traffic. The output includes real-time charts that help provide a quick overview of network activity.

However, nload does not display traffic by PID or socket, nor does it store historical data. Enter the command for your distro to install nload:

Linux distributionsnload installation command
Debian/Ubuntusudo apt install nload
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install nload -y
Fedorasudo dnf install nload -y
Arch Linuxsudo pacman -S nload
OpenSUSEsudo zypper install nload

Start nload with the following command:




Press q to exit nload and return to the command line.

NetHogs - Monitor network traffic bandwidth

The NetHogs utility tracks network usage for each process/application. It allows administrators to diagnose bandwidth spikes and determine which applications are consuming bandwidth excessively. Its main advantage is that it sorts data by process ID. To install NetHogs, enter:

Linux distributionsNethogs installation command
Debian/Ubuntusudo apt install nethogs
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install nethogs -y
Fedorasudo dnf install nethogs -y
Arch Linuxsudo pacman -S nethogs
OpenSUSEsudo zypper install nethogs

Once the installation is complete, start the NetHogs service with the following command:




Press q to exit NetHogs and return to the command prompt.

BMON – Bandwidth Monitor and Rate Estimator

BMON monitors bandwidth utilization and provides usage for each device. Users can track the bandwidth of multiple network adapters. It captures network statistics and provides a user-friendly output in graphical form. It does not store historical data but can be used for real-time diagnostics.

To install bmon, enter the command that applies to your distro:

Linux distributionsbmon installation command
Debian/Ubuntusudo apt install bmon -y
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install bmon -y
Fedorasudo dnf install bmon -y
Arch Linuxsudo pacman -S bmon
OpenSUSEsudo zypper install bmon

To start BMON, enter:




Press q to exit the BMON chart.

vnStat - Network Traffic Monitor

vnStat runs a background daemon to capture bandwidth data. It reads data from the kernel to understand resource usage. Persistent logging is the main feature of vnStat - it collects and stores bandwidth usage logs while the daemon is running.

The vnstat command can be used to display usage statistics and is best suited for statistical reports.

To install vnStat, enter the command that applies to your distribution:

Linux distributionsvnstat installation command
Debian/Ubuntusudo apt install vnstat
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install vnstat -y
Fedorasudo dnf install vnstat -y
Arch Linuxsudo pacman -S vnstat
OpenSUSEsudo zypper install vnstat

The tool can be run in real-time by specifying the following options:




Press Ctrl+C to stop real-time monitoring.

BWM-NG - Next-Generation Bandwidth Monitor

BWM-NG is a lightweight, Curses-based bandwidth monitor. It provides real-time statistics on network interfaces, showing bandwidth usage in a simple way. To install bwm-ng, enter the command that applies to your distro:

Linux distributionsbwm-ng installation command
Debian/Ubuntusudo apt install bwm-ng
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install bwm-ng -y
Fedorasudo dnf install bwm-ng -y
Arch Linuxsudo pacman -S bwm-ng
OpenSUSEsudo zypper install bwm-ng

Use the following commands to monitor real-time bandwidth usage for all interfaces:




Press q to exit BWM-NG and return to the terminal.

iPerf/iPerf3 - Network bandwidth measurement tool

iPerf monitors network bandwidth through protocols such as TCP, UDP, and SCTP and is best suited for tuning and maximizing network performance for specific protocols. iPerf requires a server and a client to test, and if you only need to measure network speed, then it is not a candidate.

To install iPerf3, enter the command that applies to your distribution:

Linux distributionsiPerf3 installation command
Debian/Ubuntusudo apt install iperf3 -y
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install iperf3 -y
Fedorasudo dnf install iperf3 -y
Arch Linuxsudo pacman -S iperf3
OpenSUSEsudo zypper install iperf3

Start iPerf3 in server mode with the -s option and listen for the connection:




Press Ctrl+C to terminate the server connection.

ss - socket statistics

The ss command is part of the iproute2 package, which is pre-installed in most Linux distributions. It replaces the older netstat command and provides detailed statistics about network connections, open sockets, and listening ports. SS doesn't focus on bandwidth monitoring like other tools on the list. However, it is essential for socket-level network diagnostics.

Enter the following command to view network connection statistics:




To display all active TCP connections, enter:




Netperf - Network Bandwidth Testing

Netperf helps monitor network bandwidth using Unix domain sockets, TCP, SCTP, DLPI, and UDP over BSD sockets. Like iPerf, Netperf also requires servers and clients for testing. Key features include numerous predefined tests for measuring performance or data transfer speed.

Use the command corresponding to your distro to install Netperf:

Linux distributionsNetperf installation command
Debian/Ubuntusudo apt install netperf
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install netperf -y
Fedorasudo dnf install netperf -y
Arch Linuxsudo pacman -S netperf
OpenSUSEsudo zypper install netperf

Start the service with the following command:




Netperf runs for a predefined amount of time and then terminates automatically.

CBM - Color Bandwidth Meter

A color bandmeter (CBM) is a small command-line utility that displays the current network traffic on all devices connected to the network. Curses-based output is displayed in color and shows each network interface, number of bytes received, bytes sent, and total bytes.

Use the corresponding command to install cbm on your distribution:

Linux distributionsNetperf installation command
Debian/Ubuntusudo apt install cbm
RHEL/Rocky Linuxsudo yum install epel-release -y
sudo yum install cbm -y
Fedorasudo dnf install cbm -y
Arch Linuxsudo pacman -S cbm
OpenSUSEsudo zypper install cbm

To start monitoring with CBM, enter:




Press q to close the window.

Original:The hyperlink login is visible.




Previous:Alibaba Cloud has built SNAT to access the public network without a public server
Next:Linux commands sudo and apt English word abbreviations
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com