How to Fix bash: iftop: command not found in Minimal Linux

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.

  1. On Ubuntu, Debian, Linux Mint, and derivatives:
    sudo apt update && sudo apt install -y iftop
  2. On CentOS, Rocky Linux, AlmaLinux, RHEL, and Fedora:
    sudo dnf install -y epel-release && sudo dnf install -y iftop
  3. On Alpine Linux:
    apk update && apk add iftop
  4. 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. eth0 or enp3s0) using the -i flag 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.

  1. Use ip -s link to monitor total bytes transmitted and received per interface.
  2. Use ss -ti to inspect active TCP socket throughput and window scaling metrics.
  3. Use nload or bmon if already present in your base image to render real-time ASCII bandwidth graphs.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.