How to install iftop on Linux

iftop is a command line tool that shows a list of active network connections between local host and any remote host, sorted by their bandwidth usage. The list of top-ranking network connections (in terms of bandwidth usage) is periodically refreshed in a ncurses-based user interface. Using iftop, you can visually check the bidirectional bandwidth usage of different network connections in real time. In order to install iftop on Linux, follow the instructions below.

To install iftop on Ubuntu, Mint or Debian, run:

$ sudo apt-get install iftop

To install iftop on CentOS or RHEL, first set up Repoforge repository on your system, and then run the following command.

$ sudo yum install iftop

To install iftop on Fedora, simply run:

$ sudo yum install iftop

If you would like to build and install the latest version of iftop manually, do the following.

$ sudo yum -y install ncurses-devel libpcap-devel
$ wget
$ tar xvfvz iftop-0.17.tar.gz
$ cd iftop-0.17
$ ./configure
$ make
$ sudo make install

Monitor Network Traffic in Real-Time with iftop

To monitor network traffic received on a specific network interface (e.g., eth0) with iftop, run the following command.

$ sudo iftop -i eth0

iftop supports rudimentary packet filtering rules with "-f" option. For example:

To monitor DNS traffic:

$ sudo iftop -i eth0 -f 'port domain'

To monitor HTTP traffic:

$ sudo iftop -i eth0 -f 'port http'

To monitor HTTP traffic while excluding a specific host:

$ sudo iftop -i eth0 -f 'port http and not host'

To monitor network traffic while ignoring broadcast packets.

$ sudo iftop -i eth0 -f 'not ether host ff:ff:ff:ff:ff:ff'

To monitor ICMP traffic:

$ sudo iftop -i eth0 -f 'icmp'

The screenshot of iftop looks as follows.

Screenshot of iftop command

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

4 thoughts on “How to install iftop on Linux

  1. I'm trying to install iftop on a few centos 6.3 machines using the tar.gz but I keep getting "configure: error: can't find pcap.h". I checked an I have libpcap installed. Any ideas?

    • You may have libpcap installed, but not a dev-version of libpcap (i.e., libpcap-devel) which contains all necessary header files. Make sure to run "sudo yum install libpcap-devel" first, before compiling iftop.

  2. Hi,

    I tried installing it using the commands you gave, but this is all I come up with:

    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    * base:
    * extras:
    * updates:
    Setting up Install Process
    No package iftop available.
    Error: Nothing to do

    Please assist!


Leave a comment

Your email address will not be published. Required fields are marked *