When Linux servers experience network congestion or unexpected bandwidth spikes, the iftop command-line utility provides top-like real-time monitoring of network bandwidth usage per active connection pair. System administrators use iftop to identify which remote IP addresses or internal sockets are saturating network interfaces. In stripped cloud virtual machines and lightweight Docker base images, running the command outputs bash: iftop: command not found.
Install iftop via Distribution Package Managers
Installing iftop is supported across all major Linux package distributions.
- On Ubuntu, Debian, Linux Mint, and derivatives:
sudo apt update && sudo apt install -y iftop - On CentOS, Rocky Linux, AlmaLinux, RHEL, and Fedora:
sudo dnf install -y epel-release && sudo dnf install -y iftop - On Alpine Linux:
apk update && apk add iftop - On Arch Linux:
sudo pacman -Sy iftop
Grant Raw Packet Capture Permissions to Non-Root Users
Because iftop listens directly on network interfaces using libpcap, non-root users require explicit packet capture capabilities.
- Execute iftop with root privileges:
sudo iftop -i eth0. - Alternatively, assign raw packet capture capabilities:
sudo setcap 'cap_net_raw,cap_net_admin+ep' $(which iftop) - Specify your active network interface (e.g.
eth0orenp3s0) using the-iflag to monitor the appropriate interface.
Alternative Network Bandwidth Telemetry Tools
If operating inside strict immutable containers where installing iftop is restricted, native utilities provide bandwidth telemetry.
- Use
ip -s linkto monitor total bytes transmitted and received per interface. - Use
ss -tito inspect active TCP socket throughput and window scaling metrics. - Use
nloadorbmonif already present in your base image to render real-time ASCII bandwidth graphs.