iftop – A Real Time Linux Network Bandwidth Monitoring Tool

In our earlier article, we have reviewed the usage of TOP Command and it’s parameters. In this article we have came up with another excellent program called Interface TOP (IFTOP) is a real time console-based network bandwidth monitoring tool.

It will show a quick overview of network activities on an interface. Iftop shows a real time updated list of network usage bandwidth every 2, 10 and 40 seconds on average. In this post we are going to see the installation and how to use IFTOP with examples in Linux.

Requirements:

  1. libpcap : library for capturing live network data.
  2. libncurses : a programming library that provides an API for building text-based interfaces in a terminal-independent way.

Install libpcap and libncurses

First start by installing libpcap and libncurses libraries using your Linux distribution package manager as shown.

$ sudo apt install libpcap0.8 libpcap0.8-dev libncurses5 libncurses5-dev  [On Debian/Ubuntu]
# yum  -y install libpcap libpcap-devel ncurses ncurses-devel             [On CentOS/RHEL]
# dnf  -y install libpcap libpcap-devel ncurses ncurses-devel             [On Fedora 22+]

Download and Install iftop

Iftop is available in the official software repositories of Debian/Ubuntu Linux, you can install it using apt command as shown.

$ sudo apt install iftop

On RHEL/CentOS, you need to enable the EPEL repository, and then install it as follows.

# yum install epel-release
# yum install  iftop

On Fedora distribution, iftop is also available from the default system repositories to install using the following command.

# dnf install iftop

Other Linux distributions, can download iftop source package using wget command and compile it from 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

Basic usage of Iftop

Once installation done, go to your console and run the iftop command without any arguments to view bandwidth usage of default interface, as shown in the screen shot below.

$ sudo iftop

Sample output of iftop command which shows bandwidth of default interface as shown below.

Monitor Linux Network Bandwidth Real Time

Monitor Linux Network Bandwidth Real Time

Monitor Linux Network Interface

First run the following ifconfig command or ip command to find all attached network interfaces on your Linux system.

$ sudo ifconfig
OR
$ sudo ip addr show

Then use the -i flag to specify the interface you want to monitor. For example the command below used to monitor bandwidth on the wireless interface on the test computer.

$ sudo iftop -i wlp2s0
Monitor Linux Wifi Network Bandwidth

Monitor Linux Wifi Network Bandwidth

To disable hostname lookups, use the -n flag.

$ sudo iftop -n  eth0

To turn on port display, use the -P switch.

$ sudo iftop -P eth0

Iftop Options and Usage

While running iftop you can use the keys like S, D to see more information like source, destination etc. Please do run man iftop if you want to explore more options and tricks. Press ‘q‘ to quit from running windows.

In this article, we’ve showed how to install and use iftop, a network interface monitoring tool in Linux. If you want to know more about iftop please visit iftop website. Kindly share it and send your comment through our comment box below.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

18 Responses

  1. occasio says:

    Thanks Murray, much appreciated.

  2. Christian P Appel says:

    Good tip, thanks!

  3. Norbert says:

    Dear Tecmint admins,

    I configured firewalld with zone work and added sources (our internal/external IP address) , restarted services , in IFTOP I can see different (strange) IP(DNS) connections . how I can disable this traffic/connection please ? Thank you .

  4. Abdou says:

    Hi Ravi , please I have a question, do you think that the traffic could be applied for a specific website ? for example, the user have 500 Kb/s for the download and 300Kb/s for the upload when he connect to zippyshare.com ( for exple) , and have the full speed when he connect to other websites ?

    • Ravi Saive says:

      Dear Vicky,

      The IfTop only monitors bandwidth it doesn’t provide any restriction module. If you want to restrict or specify bandwidth limit to specific user or website use Proxy.

  5. Rajesh.raf says:

    Ravi..thanks for your answer…:)

  6. Rajesh.raf says:

    Hi to all…. how to trace in CentOS the client user browsing which website…..?? it is possible to trace it?????

  7. Josh says:

    You know something is up with your network when it takes ages to download the libpcap library.

  8. SAM says:

    Its shoing TX == In GB

    RX == in MB

    Can u tell me how to stop transfer

  9. Patrick says:

    Thanks for this guide.

    A shame I didn’t knew about this utitily all the years I work with Linux, as it’s already included in centos 6 when using the epel repository and just needed to be installed.

  10. Rigan says:

    Nice help /.//// it work fine my centos 5.8 32bit

Leave a Reply to Josh Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.