How to Monitor Network Traffic using nethogs

29/12/2020
Chưa phân loại
nethogs is a networking monitoring tool for Linux. Just like top or htop, nethogs can monitor network traffic in real time. nethogs can monitor any specific network interface or all the networking interfaces on your computer. nethogs shows bandwidth usage per process on your computer in real time.

In this article, I am going to show you how to install and use nethogs to monitor network traffic on Linux. So, let’s get started.

Installing 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. So, you can easily install nethods with the APT package manager.

First, update the APT package manager cache with the following command:

$ sudo apt update

Now, install nethogs with the following command:

$ sudo apt install nethogs

nethogs should be installed.

Now, to check whether nethogs is working, run the following command:

$ nethogs -V

As you can see, it’s working correctly.

Installing nethogs on CentOS 7:

nethogs is not installed on CentOS 7 by default. But nethogs is available in the EPEL repository of CentOS 7. So, you can easily install nethogs from the EPEL repository with the YUM package manager.

First, enable EPEL repository with the following command:

$ sudo yum install epel-release

Now, press y and then press <Enter>.

Now, press y and then press <Enter> to accept the GPG key of the CentOS 7 repository.

EPEL repository should be enabled.

Now, run the following command to install nethogs with the YUM package manager.

$ sudo yum install nethogs

Now, press y and then press <Enter>.

Now, press y and then press <Enter> to accept the GPG key of the EPEL repository.

nethogs should be installed.

Now, to check whether nethogs is working, run the following command:

$ nethogs -V

nethogs is working perfectly.

Installing nethogs on Arch Linux:

nethogs is not installed on Arch Linux by default as well. But, nethogs is available in the official package repository of Arch Linux. So, you can easily install nethogs on Arch Linux using the Pacman package manager.

$ sudo pacman -Sy nethogs

Now, press y and then press <Enter> to continue.

nethogs should be installed.

Now, run the following command to check whether nethogs is working.

$ nethogs -V

As you can see, nethogs is working perfectly.

Using nethogs:

Now that you have nethogs installed, you’re ready to monitor your network traffic with nethogs.

If you want to monitor the network traffic of all the network interface of your computer, you can run nethogs as follows:

$ sudo nethogs -a

nethogs should start. As you can see, the network upload (sent) and download (received) speeds for each process is listed. The network interface each process is using is also listed here. The owner of the process and also the PID is listed here. If you have any process which is eating up network bandwidth unnecessarily, you can just kill the process using the PID.

nethogs should automatically update the information just like top and htop does.

By default, nethogs displays the network download and upload speeds in kilobytes/s (kb/s). This is one of the display modes of nethogs. There are 4 display modes of nethogs, the default kb/s, total bytes used (b), total kilobytes used (kb), total megabytes used (mb). You can press the m key on your keyboard to while nethogs is running to cycle through these display modes.

The default display mode of nethogs. It shows the network download and upload speed in kilobytes/s (kb/s).

Another display mode of nethogs. In this display mode the total network usage per process in kilobytes (kb) is displayed. Also the total network usage of every process (in kb) is displayed as well.

In this display mode the total network usage per process in bytes (b) is displayed. Also the total network usage of every process (in b) is displayed as well.

In this display mode the total network usage per process in megabytes (mb) is displayed. Also the total network usage of every process (in mb) is displayed as well.

You can close nethogs network monitor with <Ctrl> + c.

If you want to monitor a specific network interface using nethogs, you can easily do it.

For example, let’s say, you want to monitor the network interface ens33 with nethogs. To do that, start nethogs network monitor with the following command:

$ sudo nethogs ens33

NOTE: You can list all the network interfaces of your computer with the ip a command.

Now, only the ens33 interface should be monitored.

So, that’s how you use nethogs on Linux to monitor network traffic. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Mua Proxy US để nuôi tài khoản Facebook Ads, Ebay, Amazon

Ngày nay, cũng rất nhiều cá nhân doanh nghiệp áp dụng Proxy để kiếm tiền online. Bạn có thể sử...
13/11/2022

How to Install Minecraft Game on Ubuntu 18.04 LTS

Minecraft is an open world game. In Minecraft, you build houses, find foods, battle with enemies and so much more. Minecraft...
28/12/2020

How to Use AUR with Arch Linux

Arch User Repository, also known as AUR, is a major part of the Arch Linux ecosystem. It’s a community-driven repository...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024