iftop

iftop shows ongoing bandwidth usage on a network interface

Typical usage: diagnosing network issues, identifying bandwidth bottlenecks, and monitoring data traffic to and from a system

Introduction into iftop

The iftop command is a Linux tool to see the bandwidth by host. It listens to network traffic on the specified network interface or the first one it can find. It needs root access to be able to listen to this traffic.

In most cases it is advised to run iftop with the -n option to reduce additional traffic caused by DNS , which translates all IP addresses to hostnames.

Iftop can be instructed to monitor the traffic per network with the -F option, which might be useful to see traffic going to specific networks.

The filters that iftop uses are those from pcap, a packet capture library. The syntax is there the same as tools like tcpdump.

Project details

Background information about the iftop command.
Background information
AuthorPaul Warren
First release version0.1
First release date2002-03-29
LicenseGPLv2 or later
Requires root permissionsyes

Installation

When iftop is not installed by default, it can be added to the system using the relevant software package.

Package information for iftop

Operating systemPackage nameInstallation
AlmaLinuxiftop
dnf install iftop
Arch Linuxiftop
pacman -S iftop
Debianiftop
apt install iftop
Fedoraiftop
dnf install iftop
Red Hat Enterprise Linuxiftop
dnf install iftop
Rocky Linuxiftop
dnf install iftop
Ubuntuiftop
apt install iftop

Your Linux distribution using a different package? Share your feedback.

Usage

Available options

OptionDescription
-hShow usage summary
-nNo lookup for hostnames
-NNo lookup for service names
-pPromiscuous mode to include traffic not going via the interface
-PShow port numbers
-lInclude traffic on link-local IPv6
-mSet upper limit for scale (with K/M/G suffix)
-BBandwidth in bytes/sec instead of bits/sec
-i IFACEDefine interface IFACE
-f FILTERDefine a filter with FILTER
-F NETMASKDefine the network mask filter using NETMASK (e.g. /24)
-G NETMASK6Define the IPv6 network mask filter using NETMASK6
-c FILEDefine configuration file using FILE
-tNo ncursus output, instead print to STDOUT

Missing an option in this overview? Share your feedback.

Shortcuts and keys

Key or key combinationAction
1Sort by first column
2Sort by second column
3Sort by third column
<Sort by source
>Sort by destination
bToggle bar display
dAggregate traffic by destination
fDefine filter code
h (or ?)Show help
jMove down, useful with 'o'
kMove up, useful with 'o'
lDefine POSIX extended regular expression to filter hostnames
nEnable or disable hostnames
oFreeze current screen order
pShow or hide ports
sAggregate traffic by source
tCycle through the display modes
BCycle through bar graph period (2/10/40 seconds)
DShow or hide destination port
LToggle between lineair or logarithimic scale
NEnable or disable service names for ports
PPause or unpause output
SShow or hide source port
TShow totals

Examples using iftop

Bandwidth usage

Show active connections and bandwidth usage

iftop

Filter connections

Only show connections originating from our system to a destination on port 80 (http)

iftop -f 'dst port 80'

Frequently Asked Questions

What is the iftop command and its purpose?

The command iftop shows ongoing bandwidth usage on one or more network interfaces and is a great tool for troubleshooting network issues.

Which package provides the iftop command?

The command iftop is provided by the iftop package.

Relevant articles using the iftop command

The following articles include an example on how to use iftop and might be worth further exploring.

Related and similar commands

Linux has a lot of tools and commands available and sometimes you just need that little other tool. Here is a list of commands that are similar or related to iftop:

Related and similar commands to iftop
CommandCategorySummary
digDNSPerforms DNS requests
fuserfiles and socketsShow processes using a file or socket
ipnetworkingShows network configuration and information
nstatnetworkNetwork statistics and counters
resolvectlnetworkName resolution information from resolve daemon
sssocketsShows information about sockets
tcpdumpnetwork sniffingMonitors network traffic on specified interface

Also 💙 the command-line or terminal? Here is a set of cheat sheets for Linux to get more done from within the shell: