Monitoring real-time network traffic can help you identify bandwidth usage, detect unusual activity, and troubleshoot network-related issues. Two popular command-line tools for this purpose are “iftop” and “nload”. This guide covers how to install and use both tools on a Linux server.
Let us follow the guide:
Monitoring Traffic with “iftop”
Real-time usage of bandwidth between host pairs is displayed by “iftop.” It helps you identify which IP addresses are sending and receiving the maximum data.
- To install “iftop” on Ubuntu/Debian, execute the following command:
sudo apt update sudo apt install iftop
- On CentOS/RHEL, execute the following command:
sudo yum install epel-release sudo yum install iftop
- To use the tool to view live network traffic stats on a specific interface (e.g., eth0):
sudo iftop -i eth0
- The common controls section lists useful keyboard shortcuts for interacting with “iftop” while it’s running.
For example, you can press “t” to toggle text headers, “S” to show or hide source and destination ports, “P” to pause the live output, and “q” to quit the program. These controls help you customise the display and manage the real-time network traffic view more efficiently.
Monitoring Traffic with “nload”
For every interface, “nload” offers a simple graph-based representation of incoming and outgoing traffic.
- To install “nload” on Ubuntu/Debian, execute the following command:
sudo apt update sudo apt install nload
- On CentOS/RHEL, execute the following command:
sudo yum install epel-release sudo yum install nload
- To monitor live network traffic on a specific interface (e.g., eth0), run:
sudo nload eth0
If no interface is specified, the tool will display a list for you to choose from.
- Use the arrow keys to switch between interfaces and press “q” to exit the program.
Both “iftop” and “nload” are lightweight and effective tools to monitor real-time network traffic directly from the terminal. Use “iftop” for host-level connection details, and “nload” for a quick overview of total traffic on your interfaces.
Want more control through WHM? Learn How to manage bandwidth and disk usage with WHM