Nethogs is a “net top” utility that provides real-time bandwidth per process information. It provides you with real-time information on how the system is using its network bandwidth in terms of processes. It is helpful in cases when there is suddenly a lot of network traffic and you want to check which process is causing this.
In this post, we will be installing Nethogs on Ubuntu OS.
Note: The procedure and commands described in this post have been tested on Ubuntu 20.04 LTS.
Installing Nethogs on Ubuntu
Nethogs is available in the package repositories of Ubuntu OS. You can install it as follows:
1. First update the repositories index using the below command:
$ sudo apt update
When prompted, type the sudo password.
2. Then install Nethogs using the below command:
$ sudo apt install nethogs
If it prompts for confirmation, hit y and then Enter to confirm. Nethogs will then be installed on your machine.
3. After Nethogs is installed, you can confirm it by using the command below in Terminal:
$ nethogs -v
The output below shows that Nethogs version 0.8.5 has been installed on our machine.
To run Nethogs, you will require root privileges. You can run Nethogs using the below command as sudo or as a root in Terminal:
$ sudo nethogs
This is the result of the above command in our system. You can see 6 different columns which include PID (process ID), user, Program, network interface, and the bandwidth (Sent and Received) usage. You can find the total sent and received traffic usage at the end of the output.
By default, Nethogs shows the bandwidth usage for all the interfaces of your system. If you want to look only at one or some of the interfaces, run the Nethogs utility as follows:
$ sudo nethogs <interface1> <interface2>
For instance, to look for only interface ens33 and ens38, we will run the Nethogs utility as follows:
$ sudo nethogs ens33 ens38
There are some command-line options that can be used with the Nethogs utility. You can find these options using the below command in Terminal:
$ sudo nethogs -h
In case you want to uninstall Nethogs, use the command below in Terminal:
$ sudo apt remove nethogs
That is all there is to it! If your network connection appears to be congested and you’re not sure which application is responsible for it, try the “nethogs” utility. In today’s post, we described how to install and use the Nethogs utility in ubuntu OS. We also covered how to uninstall Nethogs in case you no longer require it in your system.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.