“iftop” Command Linux Examples

18

“iftop” is a network monitoring command in Linux that displays real-time information about your network bandwidth usage. This command can easily be installed on any Linux distribution and can be used very conveniently. This article will be based on the installation method of this command, followed by a few of its use cases.

Installing the “iftop” Command in Linux:

Since the “iftop” command is not installed by default on Linux, therefore, we will first install it with the following command:

When the “iftop” command is installed on your Linux system, you will be able to use it to check your network bandwidth usage.

“iftop” command linux examples “iftop” Command Linux Examples 1623209750 610 iftop Command Linux Examples

Syntax of the “iftop” Command in Linux:

The syntax of the “iftop” command is as follows:

These options can be explored by looking at the help manual of the “iftop” command in the manner shown below:

“iftop” command linux examples “iftop” Command Linux Examples 1623209751 529 iftop Command Linux Examples

The help manual of the “iftop” command is shown in the following image:

“iftop” command linux examples “iftop” Command Linux Examples 1623209751 220 iftop Command Linux Examples

Examples of the “iftop” Command in Linux:We will be exploring some of the options that can be used with the “iftop” command in the examples discussed below:

Example # 1: Check the Bandwidth Usage in Linux:

If you simply want to check the network bandwidth usage of your machine, then you can use the “iftop” command in the following manner:

“iftop” command linux examples “iftop” Command Linux Examples 1623209752 259 iftop Command Linux Examples

When you execute this command, it will take you to a new interface where it will show you all of its calculations, as shown in the image below:

“iftop” command linux examples “iftop” Command Linux Examples 1623209752 60 iftop Command Linux Examples

You will be able to exit this interface by pressing Ctrl+ C, as shown in the following image:

“iftop” command linux examples “iftop” Command Linux Examples 1623209752 847 iftop Command Linux Examples

Example # 2: Display the Bandwidth in Bytes in Linux:

If you want to display your network bandwidth in Bytes, then you can modify the “iftop” command as follows:

“iftop” command linux examples “iftop” Command Linux Examples 1623209753 63 iftop Command Linux Examples

Again, you will be taken to a new interface upon the execution of this command where you will be able to see the bandwidth in Bytes as shown in the image below:

“iftop” command linux examples “iftop” Command Linux Examples 1623209753 671 iftop Command Linux Examples

You will be able to exit this interface by pressing Ctrl+ C, as shown in the following image:

“iftop” command linux examples “iftop” Command Linux Examples 1623209754 498 iftop Command Linux Examples

 

Example # 3: Show Port Numbers along with Hostnames in Linux:

If you also want the port numbers to be displayed along with the hostnames in the output, then you can use the below-shown variation of the “iftop” command:

“iftop” command linux examples “iftop” Command Linux Examples 1623209754 110 iftop Command Linux Examples

You can easily see from the image that now the port numbers are displayed along with the hostnames in the output of the “iftop” command.

“iftop” command linux examples “iftop” Command Linux Examples 1623209754 947 iftop Command Linux Examples

You will be able to exit this interface by pressing Ctrl+ C, as shown in the following image:

“iftop” command linux examples “iftop” Command Linux Examples 1623209755 637 iftop Command Linux Examples

Example # 4: Sort the Output by Source Address in Linux:

If you want the output of the “iftop” command to be sorted by the source address, then you can use this command in the manner shown below:

“iftop” command linux examples “iftop” Command Linux Examples 1623209755 168 iftop Command Linux Examples

Running the “iftop” command in this manner will sort the output according to the source address as shown in the image that follows:

“iftop” command linux examples “iftop” Command Linux Examples 1623209756 376 iftop Command Linux Examples

You will be able to exit this interface by pressing Ctrl+ C, as shown in the following image:

“iftop” command linux examples “iftop” Command Linux Examples 1623209756 973 iftop Command Linux Examples

Example # 5: Sort the Output by Destination Address in Linux:

If you want the output of the “iftop” command to be sorted by the destination address, then you can use this command in the manner shown below:

$ sudo iftop –o destination

“iftop” command linux examples “iftop” Command Linux Examples 1623209756 402 iftop Command Linux Examples

Running the “iftop” command in this manner will sort the output according to the destination address as shown in the image that follows:

“iftop” command linux examples “iftop” Command Linux Examples 1623209757 724 iftop Command Linux Examples

You will be able to exit this interface by pressing Ctrl+ C, as shown in the following image:

“iftop” command linux examples “iftop” Command Linux Examples 1623209757 47 iftop Command Linux Examples

Conclusion:

By going through today’s guide, you will have a piece of good knowledge about using the “iftop” command in Linux. You can also explore its other examples using its different options presented to you in its help manual.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More