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.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related system monitoring tools Installation queries.
In this context, we shall look into method to Install Nethogs on Ubuntu 20.04 LTS.
Nethogs is available in the package repositories of Ubuntu OS. You can follow the steps outlined below to install it.
1. Perform system Update
Start with updating the system's repositories index with the below command:
$ sudo apt update
When prompted, type the sudo password.
2. Install Nethogs
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. Verify Nethogs Installation
After Nethogs is installed, you can confirm it by using the command below in Terminal:
$ nethogs -v
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
From the output, You can see 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 from your Ubuntu 20.04 LTS, then simply execute the command below in your Terminal:
$ sudo apt remove nethogs
This article covers how to install and use the Nethogs utility in Ubuntu 20.04 LTS. In fact, nethogs is a networking monitoring tool for Linux capable of monitoring any specific network interface or all the networking interfaces on your computer. Also, it shows bandwidth usage per process on your computer in real time.
How to install nethogs on Ubuntu / Debian ?
nethogs is not installed on Ubuntu/Debian by default. But, it is available in the official package repository of Ubuntu/Debian.
1. First, update the APT package manager cache with the following command:
$ sudo apt update
2. Now, install nethogs with the following command:
$ sudo apt install nethogs
3. Now, to check whether nethogs is working, run the following command:
$ nethogs -V