iftop – A Real Time Linux Network Bandwidth Monitoring Tool
You can install and use the iftop utility on Linux. This command listens to network traffic on a given interface (such as eth0 or eth1) and shows a table of current bandwidth usage by pairs of hosts. iftop must be run with sufficient permissions (usually as root user) to monitor all network traffic on the interface.
Download and install iftop
Iftop is available in the official software repositories of Debian/Ubuntu Linux, you can install it using the apt command as shown.
Start by ensuring your system is updated.
apt update && apt -y upgrade
$ apt install iftop
On RHEL/CentOS, you need to enable the EPEL repository, and then install it as follows.
yum update && yum upgrade
# yum install epel-release # yum install iftop
Other Linux distributions, can download the iftop source package using the wget command and compile it from the source as shown.
# wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz # tar -zxvf iftop-0.17.tar.gz # cd iftop-0.17 # ./configure # make # make install
Run iftop
Once installation is done, go to your console and run the iftop command without any arguments to view the bandwidth usage of the default interface, as shown in the screenshot below.
Without additional parameters, iftop will monitor all the inbound and outbound traffic on the default network interface. eg: eth0.
To monitor a different network interface, e.g: eth0, you would need to pass the interface name to the iftop command using the -i parameter:
# iftop -i eth0
Don’t do DNS hostname lookups
By default, iftop will look up the hostnames associated with addresses it finds in packets. Pass the -n option to disable DNS lookup:
# iftop -n -i eth0
Hide service name and port numbers
Pass the -N option to hide resolve port number to service names:
# iftop -N -i eth0
ICMP bandwidth stats
Find out more about ICMP ping requests and bandwidth usage per interface by host. Use the -f to set the filter:
# iftop -f icmp -i eth0
Hide bar graphs
Pass the -b option to turn off display bar graphs of traffic:
# iftop -b -i eth0
Pass the -B option to display bandwidth rates in bytes/sec rather than bits/sec:
# iftop -B -i eth0
This concludes our tutorial. For more information on how to use iftop, please refer to Iftop’s website.