Skip to content

iftop - Live Network Connection Bandwidth Cheatsheet

iftop - Live Network Connection Bandwidth Cheatsheet

iftop is a top-like tool for network bandwidth by connection. It listens on an interface and shows a live, sorted list of traffic between pairs of hosts — your machine and each remote endpoint — with running averages over 2, 10, and 40 seconds. Where nethogs groups by process, iftop groups by connection, which is what you want when the question is “which remote host / connection is eating the link?” It needs root to capture packets.

Installation

PlatformCommand
Debian/Ubuntusudo apt install iftop
Fedora/RHELsudo dnf install iftop
Arch Linuxsudo pacman -S iftop
macOS (Homebrew)brew install iftop
Verifyiftop -h

Running

CommandDescription
sudo iftopMonitor the default interface
sudo iftop -i eth0Monitor a specific interface
sudo iftop -nDon’t resolve hostnames (show IPs, faster)
sudo iftop -PShow ports as well as hosts
sudo iftop -BShow bandwidth in bytes (not bits)
sudo iftop -F 10.0.0.0/24Only traffic for a network/host

Reading the Display

ElementMeaning
Left columnLocal host
Right columnRemote host
=> / <=Send / receive direction
Three numbersAvg over last 2s / 10s / 40s
BarsRelative bandwidth of each pair
Bottom summaryTX / RX / TOTAL cumulative + peak + rates

Interactive Keys

KeyAction
nToggle DNS resolution
pToggle port display
PPause the display
bToggle the bandwidth bars
tCycle line-display modes (one/two line, per-direction)
S / DToggle showing source / destination ports
1 / 2 / 3Sort by the 2s / 10s / 40s column
j / kScroll
qQuit

Useful Options

OptionDescription
-i IFACEInterface to monitor
-nNo DNS resolution
-NNo port-to-service resolution
-PDisplay ports
-BBytes instead of bits
-f "filter"pcap filter (e.g. -f "port 443")
-m RATESet the graph scale maximum

Common Workflows

# Which remote hosts are busiest on eth0, fast (no DNS)
sudo iftop -i eth0 -n

# Include ports to see which service is talking
sudo iftop -i eth0 -nP

# Focus on HTTPS traffic only
sudo iftop -i eth0 -f "port 443"

# Watch traffic to a specific subnet
sudo iftop -i eth0 -F 192.168.1.0/24
ToolGroups byBest question
iftopConnection (host pairs)“Which connection/remote is busy?“
nethogsProcess”Which program is using bandwidth?“
bandwhichProcess + connection + remoteBoth, richer TUI
nload / bmonInterface totals”What’s the total throughput?”

Pair iftop (which connection) with nethogs (which process) to fully diagnose a bandwidth problem.

Resources