Home > Network Management > iftop

iftop: Real-time Network Bandwidth Monitoring

iftop is a command-line tool that displays real-time bandwidth usage on a network interface. It visualizes transmitted and received traffic by source/destination IP addresses and ports, making it useful for diagnosing network issues and analyzing usage.

Overview

iftop monitors network traffic in real-time, similar to the `top` command. By default, it displays the connections using the most bandwidth at the top, allowing you to see total bandwidth usage, average usage, and more.

Key Features

  • Real-time network bandwidth usage display
  • Interface-specific traffic monitoring
  • Source/destination IP and port information
  • Various sorting and filtering options
  • Interactive mode support

Key Options

The main options for iftop are used to specify the interface to monitor, control output format, and filter traffic.

Basic Settings

Filtering

Output Format

Generated command:

Try combining the commands.

Description:

`iftop` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Effectively monitor network traffic with various iftop usage examples.

Basic Usage

sudo iftop

Monitors real-time traffic on the default network interface.

Monitor Specific Interface

sudo iftop -i eth0

Monitors traffic on the specified 'eth0' interface.

Display IP Addresses and Port Numbers

sudo iftop -nP

Displays IP addresses instead of hostnames and port numbers instead of service names.

Monitor Specific Subnet Traffic Only

sudo iftop -F 192.168.1.0/24

Filters and displays only traffic belonging to the 192.168.1.0/24 subnet.

Installation

iftop is not included by default in most Linux distributions and needs to be installed via a package manager.

Debian/Ubuntu

sudo apt update && sudo apt install iftop

Installs iftop using the apt package manager.

CentOS/RHEL/Fedora

sudo dnf install iftop

Installs iftop using the dnf (or yum) package manager.

Tips & Notes

Tips and points to consider for efficient iftop usage.

Interactive Keys

Press the following keys while iftop is running to change the screen display.

  • `p`: Toggle port display
  • `n`: Toggle hostname/IP address display
  • `s`: Toggle source host display
  • `d`: Toggle destination host display
  • `t`: Toggle text output format (2-line/1-line/3-line)
  • `q`: Quit iftop

Permissions

iftop requires `sudo` privileges because it directly monitors network interfaces.

Interpreting Output

Meaning of the main metrics displayed on the iftop screen.

  • TX: Transmit (Upload) Traffic
  • RX: Receive (Download) Traffic
  • TOTAL: Total Traffic (TX + RX)
  • cum: Cumulative total traffic since iftop started
  • avg: Average traffic over 2s, 10s, and 40s intervals

Same category commands