Share your love
Monitor Linux Network Bandwidth Usage with nload Command
In this guide, we want to teach you to Monitor Linux Network Bandwidth Usage with the nload Command.
nload is a command-line utility that can be used to monitor network traffic and bandwidth usage in real-time. It visualizes the incoming and outgoing traffic using two graphs and also provides additional information like min/max network usage and total transferred data.
How To Monitor Linux Network Bandwidth Usage with nload Command
In this guide, you will learn how to install and use nload to monitor Linux network traffic and bandwidth utilization in real-time.
Follow the steps below to complete this guide.
Install nload on Centos / RHEL / Fedora
nload can be easily installed by enabling the EPEL repository on CentOS or RHEL-based systems.
First, install Epel with the following command:
yum install epel-release or dnf install epel-release
Then, use the following command to install the nload command:
yum install nload or dnf install nload
Install nload on Ubuntu / Debian
On Debian/Ubuntu, nload can be installed from the default system repositories as shown.
apt install nload
After installing nload, you can see all options available with nload using the following command:
nload --help
You should see the following screen:
Output
Command line syntax:
nload [options] [devices]
nload --help|-h
Options:
-a period Sets the length in seconds of the time window for average
calculation.
Default is 300.
-i max_scaling Specifies the 100% mark in kBit/s of the graph indicating the
incoming bandwidth usage. Ignored if max_scaling is 0 or the
switch -m is given.
Default is 10240.
-m Show multiple devices at a time; no traffic graphs.
-o max_scaling Same as -i but for the graph indicating the outgoing bandwidth
usage.
Default is 10240.
-t interval Determines the refresh interval of the display in milliseconds.
Default is 500.
...
Monitor Network Traffic And Bandwidth Usage In Real Time
Run nload command without any option will start monitoring all network devices:
nload
Output
Device cni-podman0 [...] (1/3):
================================================================================
Incoming:
Curr: 0.00 Bit/s
Avg: 0.00 Bit/s
Min: 0.00 Bit/s
Max: 0.00 Bit/s
Ttl: 808.00 Byte
Outgoing:
Curr: 0.00 Bit/s
Avg: 0.00 Bit/s
Min: 0.00 Bit/s
Max: 0.00 Bit/s
Ttl: 854.00 Byte
After running the nload command, you can control the monitoring screen using the following shortcut keys:
- left and right arrow keys or Enter/Tab are used to switch between the devices.
- The F2 key is used to see the options window.
- The F5 key is used to save your current settings.
- The F6 key is used to load your settings from the config file.
- q key is used to exit from the nload console.
You can use the -m flag with the nload command to display all network interfaces at the same time without the graphs.
nload -m
Output
Device cni-podman0 [...] (1/3):
================================================================================
Incoming: Outgoing:
Curr: 0.00 Bit/s Curr: 0.00 Bit/s
Avg: 0.00 Bit/s Avg: 0.00 Bit/s
Min: 0.00 Bit/s Min: 0.00 Bit/s
Max: 0.00 Bit/s Max: 0.00 Bit/s
Ttl: 808.00 Byte Ttl: 854.00 Byte
Device eth0 [...] (2/3):
================================================================================
Incoming: Outgoing:
Curr: 26.37 kBit/s Curr: 28.23 kBit/s
Avg: 12.68 kBit/s Avg: 18.38 kBit/s
Min: 5.60 kBit/s Min: 11.55 kBit/s
Max: 30.31 kBit/s Max: 30.92 kBit/s
Ttl: 478.05 MByte Ttl: 46.10 MByte
You can use the -a flag with the nload command to set the length in seconds of the time window for average calculation. By default, it is set to 300.
For example, set the duration to 400 seconds as shown below:
nload -a 400
You can use the -t flag with the nload command to sets the refresh interval of the display in milliseconds. By default, it is set to 500 seconds.
For example, set the refresh interval to 200 as shown below:
nload -t 200
You can also define the specific network device with the nload command.
For example, to monitor the eth0 device use the following command:
nload devices eth0
You can also combine all options in a single command to analyze the network traffic according to our needs.
For example, use the following option to monitor all devices with a time window of 300 seconds and a refresh rate of 600 milliseconds.
nload -m -a 300 -t 600
Conclusion
At this point, you learn to Monitor Linux Network Bandwidth Usage with the nload Command.
Hope you enjoy it.
You may be interested in these articles:
Introduce Stress Test Tools for CPU