How to install iftop on Rocky Linux 9.3

To Install Iftop On Rocky Linux 9.3

Introduction:

iftop is a command line tool that shows a list of active network connections between the 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.

Installation Steps:

Step 1: Check the OS version by using the below Command.

[root@linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.3 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.3 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.3"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"

Step 2: Enable the EPEL and CRB repository by using the below command.

 [root@linuxhelp ~]# dnf install epel-release
Rocky Linux 9 - BaseOS                                                                     4.3 kB/s | 4.1 kB     00:00    
Rocky Linux 9 - BaseOS                                                                     1.2 MB/s | 2.2 MB     00:01    
Rocky Linux 9 - AppStream                                                                  4.1 kB/s | 4.5 kB     00:01    
Rocky Linux 9 - AppStream                                                                  3.2 MB/s | 7.9 MB     00:02    
Rocky Linux 9 - Extras                                                                     3.0 kB/s | 2.9 kB     00:00    
Rocky Linux 9 - Extras                                                                     9.8 kB/s |  15 kB     00:01    
Dependencies resolved.
===========================================================================================================================
 Package                          Architecture               Version                      Repository                  Size
===========================================================================================================================
Installing:
 epel-release                     noarch                     9-7.el9                      extras                      19 k

Transaction Summary
===========================================================================================================================
Install  1 Package

Total download size: 19 k
Installed size: 26 k
Is this ok [y/N]: y
Downloading Packages:
[MIRROR] epel-release-9-7.el9.noarch.rpm: Status code: 404 for https://rocky-linux-asia-south2.production.gcp.mirrors.ctrliq.cloud/pub/rocky//9.4/extras/x86_64/os/Packages/e/epel-release-9-7.el9.noarch.rpm (IP: 34.160.207.236)
[MIRROR] epel-release-9-7.el9.noarch.rpm: Status code: 404 for https://rocky-linux-asia-south1.production.gcp.mirrors.ctrliq.cloud/pub/rocky//9.4/extras/x86_64/os/Packages/e/epel-release-9-7.el9.noarch.rpm (IP: 34.49.113.43)
epel-release-9-7.el9.noarch.rpm                                                             21 kB/s |  19 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                       12 kB/s |  19 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                   1/1 
  Installing       : epel-release-9-7.el9.noarch                                                                       1/1 
  Running scriptlet: epel-release-9-7.el9.noarch                                                                       1/1 
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.

  Verifying        : epel-release-9-7.el9.noarch                                                                       1/1 

Installed:
  epel-release-9-7.el9.noarch                                                                                              

Complete!

[root@linuxhelp ~]# /usr/bin/crb enable
Enabling CRB repo
CRB repo is enabled and named: crb

Step 3: Install libpcap and libncurses libraries using Linux distribution package manager by using the below command

[root@linuxhelp ~]# dnf install libpcap libpcap-devel ncurses ncurses-devel
Rocky Linux 9 - CRB                                                                        149 kB/s | 2.4 MB     00:16    
Last metadata expiration check: 0:00:03 ago on Saturday 11 May 2024 02:52:06 AM.
Package libpcap-14:1.10.0-4.el9.x86_64 is already installed.
Package ncurses-6.2-10.20210508.el9.x86_64 is already installed.
Dependencies resolved.
===========================================================================================================================
Package                         Architecture          Version                              Repository                Size
===========================================================================================================================
Installing:
libpcap-devel                   x86_64                14:1.10.0-4.el9                      crb                      142 k
ncurses-devel                   x86_64                6.2-10.20210508.el9                  appstream                516 k
Installing dependencies:
ncurses-c++-libs                x86_64                6.2-10.20210508.el9                  appstream                 36 k

Transaction Summary
===========================================================================================================================
Install  3 Packages

Total download size: 694 k
Installed size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): ncurses-c++-libs-6.2-10.20210508.el9.x86_64.rpm                                      71 kB/s |  36 kB     00:00    
(2/3): libpcap-devel-1.10.0-4.el9.x86_64.rpm                                               268 kB/s | 142 kB     00:00    
(3/3): ncurses-devel-6.2-10.20210508.el9.x86_64.rpm                                        880 kB/s | 516 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                      358 kB/s | 694 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
 Preparing        :                                                                                                   1/1 
 Installing       : ncurses-c++-libs-6.2-10.20210508.el9.x86_64                                                       1/3 
 Installing       : ncurses-devel-6.2-10.20210508.el9.x86_64                                                          2/3 
 Installing       : libpcap-devel-14:1.10.0-4.el9.x86_64                                                              3/3 
 Running scriptlet: libpcap-devel-14:1.10.0-4.el9.x86_64                                                              3/3 
 Verifying        : ncurses-devel-6.2-10.20210508.el9.x86_64                                                          1/3 
 Verifying        : ncurses-c++-libs-6.2-10.20210508.el9.x86_64                                                       2/3 
 Verifying        : libpcap-devel-14:1.10.0-4.el9.x86_64                                                              3/3 

Installed:
 libpcap-devel-14:1.10.0-4.el9.x86_64                       ncurses-c++-libs-6.2-10.20210508.el9.x86_64                  
 ncurses-devel-6.2-10.20210508.el9.x86_64                  

Complete!

Step 4: Install iftop by using the below command.

[root@linuxhelp ~]# dnf install iftop
Last metadata expiration check: 0:00:58 ago on Saturday 11 May 2024 02:52:06 AM.
Dependencies resolved.
===========================================================================================================================
Package                   Architecture               Version                               Repository                Size
===========================================================================================================================
Installing:
iftop                     x86_64                     1.0-0.26.pre4.el9                     epel                      52 k

Transaction Summary
===========================================================================================================================
Install  1 Package

Total download size: 52 k
Installed size: 98 k
Is this ok [y/N]: y
Downloading Packages:
iftop-1.0-0.26.pre4.el9.x86_64.rpm                                                          96 kB/s |  52 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                       32 kB/s |  52 kB     00:01     
Extra Packages for Enterprise Linux 9 - x86_64                                             1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x3228467C:
Userid     : "Fedora (epel9) <epel@fedoraproject.org>"
Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
 Preparing        :                                                                                                   1/1 
 Installing       : iftop-1.0-0.26.pre4.el9.x86_64                                                                    1/1 
 Running scriptlet: iftop-1.0-0.26.pre4.el9.x86_64                                                                    1/1 
 Verifying        : iftop-1.0-0.26.pre4.el9.x86_64                                                                    1/1 

Installed:
 iftop-1.0-0.26.pre4.el9.x86_64                                                                                           

Complete!

Step 5: Download iftop source package using wget command

 [root@linuxhelp ~]# wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
--2024-05-11 02:54:01--  http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
Resolving www.ex-parrot.com (www.ex-parrot.com)... 46.235.227.5, 2a00:1098:82::e:1
Connecting to www.ex-parrot.com (www.ex-parrot.com)|46.235.227.5|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://pdw.ex-parrot.com/iftop/download/iftop-0.17.tar.gz [following]
--2024-05-11 02:54:02--  https://pdw.ex-parrot.com/iftop/download/iftop-0.17.tar.gz
Resolving pdw.ex-parrot.com (pdw.ex-parrot.com)... 46.235.227.5, 2a00:1098:82::e:1
Connecting to pdw.ex-parrot.com (pdw.ex-parrot.com)|46.235.227.5|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 160381 (157K) [application/gzip]
Saving to: ‘iftop-0.17.tar.gz’

iftop-0.17.tar.gz              100%[===================================================>] 156.62K   314KB/s    in 0.5s    

2024-05-11 02:54:04 (314 KB/s) - ‘iftop-0.17.tar.gz’ saved [160381/160381]

 [root@linuxhelp ~]# ll
total 164
-rw-------. 1 root root   1349 Mar 15 14:08 anaconda-ks.cfg
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Desktop
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Documents
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Downloads
-rw-r--r--. 1 root root 160381 Feb 13  2006 iftop-0.17.tar.gz
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Music
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Pictures
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Public
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Templates
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Videos

Step 6: Extract the download iftop source package by using the below command.

[root@linuxhelp ~]# tar -zxvf iftop-0.17.tar.gz
 [root@linuxhelp ~]# ll
total 168
-rw-------. 1 root root   1349 Mar 15 14:08 anaconda-ks.cfg
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Desktop
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Documents
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Downloads
drwxrwxrwx. 3  501  501   4096 Feb 13  2006 iftop-0.17
-rw-r--r--. 1 root root 160381 Feb 13  2006 iftop-0.17.tar.gz
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Music
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Pictures
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Public
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Templates
drwxr-xr-x. 2 root root      6 Mar 15 16:36 Videos

Step 7: Change the directory to extracted iftop source package directory by using the below command.

 [root@linuxhelp ~]# cd iftop-0.17
[root@linuxhelp iftop-0.17]# ll
total 680
-rw-r--r--. 1 501 501  30855 Feb 13  2006 aclocal.m4
-rw-r--r--. 1 501 501   1634 Oct 10  2002 addr_hash.c
-rw-r--r--. 1 501 501    488 Feb  6  2003 addr_hash.h
-rw-r--r--. 1 501 501   9955 Oct 15  2003 addrs_dlpi.c
-rw-r--r--. 1 501 501   3537 Dec 24  2005 addrs_ioctl.c
-rw-r--r--. 1 501 501    184 Aug 27  2003 AUTHORS
-rwxr-xr-x. 1 501 501    246 Nov  4  2002 bootstrap
-rw-r--r--. 1 501 501   6051 Dec 24  2005 cfgfile.c
-rw-r--r--. 1 501 501    481 Oct 19  2003 cfgfile.h
-rw-r--r--. 1 501 501   4840 Feb 13  2006 ChangeLog
drwxrwxrwx. 2 501 501   4096 Feb 13  2006 config
-rw-r--r--. 1 501 501   4073 Feb 13  2006 config.h.in
-rwxr-xr-x. 1 501 501 228530 Feb 13  2006 configure
-rw-r--r--. 1 501 501  14804 Feb 13  2006 configure.in
-rw-r--r--. 1 501 501  17992 Jun  7  2003 COPYING
-rw-r--r--. 1 501 501  29884 Jun  7  2003 dlcommon.c
-rw-r--r--. 1 501 501    563 Jun  7  2003 dlcommon.h
-rw-r--r--. 1 501 501   3539 Nov  4  2002 edline.c
-rw-r--r--. 1 501 501    409 Mar 31  2005 ether.h
-rw-r--r--. 1 501 501   3571 Jun  7  2003 ethertype.h
-rw-r--r--. 1 501 501   2448 Jun  7  2003 extract.h
-rw-r--r--. 1 501 501   3229 Oct 27  2005 hash.c
-rw-r--r--. 1 501 501   1065 Oct 27  2005 hash.h
-rw-r--r--. 1 501 501  11320 Dec 25  2005 iftop.8
-rw-r--r--. 1 501 501  14656 Mar 31  2005 iftop.c
-rw-r--r--. 1 501 501  14578 Dec 25  2005 iftop.cat
-rw-r--r--. 1 501 501    649 Oct 14  2003 iftop.h
-rw-r--r--. 1 501 501   1591 Feb 13  2006 iftop.spec
-rw-r--r--. 1 501 501    997 Nov  4  2002 INSTALL
-rw-r--r--. 1 501 501   2262 Nov  4  2002 integers.h
-rw-r--r--. 1 501 501   5736 Jun  7  2003 ip.h
-rw-r--r--. 1 501 501   3596 Jun  7  2003 llc.h
-rw-r--r--. 1 501 501   1480 Jul 27  2004 Makefile.am
-rw-r--r--. 1 501 501  21178 Feb 13  2006 Makefile.in
-rw-r--r--. 1 501 501   3782 Nov  4  2002 Makefile.OLD
-rw-r--r--. 1 501 501     94 Jun  7  2003 NEWS
-rw-r--r--. 1 501 501   1382 Oct 21  2002 ns_hash.c
-rw-r--r--. 1 501 501    304 Feb  6  2003 ns_hash.h
-rw-r--r--. 1 501 501  14843 Feb  8  2006 options.c
-rw-r--r--. 1 501 501   1631 Feb  8  2006 options.h
-rw-r--r--. 1 501 501   2784 Dec 26  2005 ppp.h
-rw-r--r--. 1 501 501   1332 Jun  7  2003 README
-rw-r--r--. 1 501 501  12073 Dec 24  2005 resolver.c
-rw-r--r--. 1 501 501    317 Feb  6  2003 resolver.h
-rw-r--r--. 1 501 501   1028 Nov  4  2002 screenfilter.c
-rw-r--r--. 1 501 501    406 Nov  4  2002 screenfilter.h
-rw-r--r--. 1 501 501   1619 Oct 27  2005 serv_hash.c
-rw-r--r--. 1 501 501    378 Oct 27  2005 serv_hash.h
-rw-r--r--. 1 501 501   5501 Jun  7  2003 sll.h
-rw-r--r--. 1 501 501    946 Mar 24  2002 sorted_list.c
-rw-r--r--. 1 501 501    598 Mar 24  2002 sorted_list.h
-rw-r--r--. 1 501 501   2889 Nov  7  2003 stringmap.c
-rw-r--r--. 1 501 501    767 Oct 19  2003 stringmap.h
-rw-r--r--. 1 501 501   3475 Jun  7  2003 tcp.h
-rw-r--r--. 1 501 501   2146 Oct 11  2002 threadprof.c
-rw-r--r--. 1 501 501    234 Oct 11  2002 threadprof.h
-rw-r--r--. 1 501 501    442 Oct 21  2003 TODO
-rw-r--r--. 1 501 501   2390 Jun  7  2003 token.h
-rw-r--r--. 1 501 501  31818 Oct 27  2005 ui.c
-rw-r--r--. 1 501 501    180 Feb  6  2003 ui.h
-rw-r--r--. 1 501 501   1070 Mar 24  2002 util.c
-rw-r--r--. 1 501 501   1741 Nov  7  2003 vector.c
-rw-r--r--. 1 501 501    971 Oct 19  2003 vector.h

Step 8: Execute the configure script by using the ./ command.

[root@linuxhelp iftop-0.17]# ./configure

Step 9: Run make & make install command.

[root@linuxhelp iftop-0.17]# make
[root@linuxhelp iftop-0.17]# make install

Step 10: Run the iftop command without any arguments to view bandwidth usage of default interface, as shown in the below image

[root@linuxhelp iftop-0.17]# iftop
interface: ens160
IP address is: 192.168.6.130
MAC address is: 00:0c:29:58:7a:ef

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install iftop on Rocky Linux 9.3. Your feedback is much welcome.

FAQ
Q
Does iftop provide any graphical interface?
A
No, iftop is a command-line tool and does not have a graphical interface. However, it provides real-time textual data about network connections which can be very informative.
Q
Are there any additional options or parameters for iftop?
A
Yes, you can use various command-line options with iftop to customize its behavior. Typing man iftop in the terminal will display the manual page with all available options.
Q
Can I run iftop as a regular user?
A
No, iftop requires root privileges to capture network data so, run it with sudo or as the root user.
Q
How do I start iftop after installation?
A
You can start iftop by simply typing sudo iftop in your terminal after installation.
Q
What is iftop? explain?
A
iftop is a network monitoring tool that shows a list of network connections in real-time, allowing users to monitor bandwidth usage.