Table of Contents
iftop
is a tool used on Linux-based operating systems to monitor network traffic in real-time. The name is a shortening of “interface top,” and it provides a visual interface to display network connections, data transfers, and bandwidth usage on the system.
Here are the key features of iftop
:
- Visual Network Traffic Monitoring:
iftop
visually displays network traffic in the terminal with a colorful interface. This allows for quick differentiation of different connections.
- Real-time Monitoring:
- Network traffic statistics are updated in real-time. It shows how much data is being transferred from and to which IP addresses or ports.
- Connection Details:
iftop
displays detailed information about connecting and receiving IP addresses, ports, and the bandwidth used.
- Filtering and Sorting:
iftop
offers options to filter and sort displayed network traffic based on specific IP addresses, ports, or protocols.
- Monitoring Changes Over Time:
- It has the capability to monitor changes in network traffic over a specific period. This is useful for understanding fluctuations in network performance.
iftop
is commonly preferred by system administrators and network specialists for network traffic management and monitoring.
iftop
, you may need to use different commands depending on your operating system’s package management system. Here are commands for some common Linux distributions:Debian and Ubuntu-based systems:
sudo apt update
sudo apt install iftop
Red Hat, CentOS, and Fedora-based systems:
sudo yum install epel-release # If epel-release is not installed
sudo yum install iftop
Arch Linux-based systems:
sudo pacman -S iftop
openSUSE-based systems:
sudo zypper install iftop
macOS (using Homebrew):
brew install iftop
By using the above commands, you can install iftop
on your system. If you encounter any errors, you can resolve the issue by checking your system’s package management system or verifying if iftop
is not supported on your system.
Basic Usage:
- Install iftop:
# Debian/Ubuntu sudo apt update sudo apt install iftop # Red Hat/CentOS sudo yum install epel-release # If epel-release is not installed sudo yum install iftop # Arch Linux sudo pacman -S iftop # openSUSE sudo zypper install iftop # macOS (using Homebrew) brew install iftop
- Run iftop:
iftop
Navigation:
- Up/Down Arrow Keys:
- Scroll through the list of connections.
- Left/Right Arrow Keys:
- Switch between different columns.
- n:
- Toggle DNS resolution for IP addresses.
Filtering:
- b:
- Toggle bar display for bandwidth.
- B:
- Toggle bytes mode (show traffic in bytes).
- d:
- Set display filter (enter a display filter expression).
- s:
- Set sort field (choose a column to sort by).
Preferences:
- t:
- Toggle the display of a status bar.
- p:
- Toggle the display of a port column.
- N:
- Toggle the display of a port numbers column.
Quitting:
- q:
- Quit
iftop
.
- Quit
Note:
- Pressing
?
while runningiftop
will display a help screen with additional commands and options.
This cheat sheet covers some common commands to get you started with iftop
. Feel free to explore more features by referring to the built-in help (?
) or the iftop
manual (man iftop
).