UbuntuUbuntu Based

How To Install Nethogs on Ubuntu 24.04 LTS

Install Nethogs on Ubuntu 24.04

In this tutorial, we will show you how to install Nethogs on Ubuntu 24.04 LTS. In today’s interconnected world, monitoring network traffic is crucial for system administrators and power users alike. Nethogs, a powerful “net top” tool, provides real-time insights into network bandwidth usage on a per-process basis. This article will guide you through the process of installing and using Nethogs on Ubuntu 24.04 LTS, equipping you with the knowledge to effectively monitor and manage your system’s network activity.

Understanding Nethogs and Its Importance

Nethogs is a small yet powerful utility that breaks down network traffic by process rather than by protocol or subnet. This unique approach allows users to quickly identify which applications or processes are consuming the most bandwidth, making it an invaluable tool for network troubleshooting and optimization.

Key features of Nethogs include:

  • Real-time monitoring of network usage
  • Process-specific bandwidth tracking
  • Support for both IPv4 and IPv6 connections
  • Minimal system resource consumption
  • Easy-to-use command-line interface

Whether you’re managing a busy server or simply curious about your personal computer’s network activity, Nethogs provides valuable insights that can help you maintain optimal network performance.

Prerequisites for Installing Nethogs

Before we dive into the installation process, ensure that your system meets the following requirements:

  • A computer running Ubuntu 24.04 LTS
  • An active internet connection
  • Sudo privileges on your account
  • Basic familiarity with the terminal

It’s always a good practice to update your system before installing new software. Open a terminal and run the following commands:

sudo apt update
sudo apt upgrade

This will ensure that your system has the latest package information and security updates.

Step-by-Step Installation of Nethogs

Now that your system is up-to-date, let’s proceed with the installation of Nethogs.

1. Update Package Lists

First, refresh your package lists to ensure you have the most recent information:

sudo apt update

2. Install Nethogs

Next, install Nethogs using the apt package manager:

sudo apt install nethogs

The system will prompt you to confirm the installation. Type ‘Y’ and press Enter to proceed.

3. Verify Installation

After the installation completes, verify that Nethogs was installed correctly by checking its version:

nethogs -V

This command should display the version of Nethogs installed on your system.

Running and Using Nethogs

Now that Nethogs is installed, let’s explore how to use this powerful tool effectively.

Basic Usage

To start Nethogs with default settings, simply run:

sudo nethogs

This command will display a real-time list of processes using your network, sorted by bandwidth usage.

Install Nethogs on Ubuntu 24.04

Customizing Nethogs

Nethogs offers several options to customize its output:

  • Monitor specific interfaces: sudo nethogs eth0
  • Set refresh rate: sudo nethogs -d 5 (refreshes every 5 seconds)
  • Display traffic in KB/s: sudo nethogs -K

Interpreting Nethogs Output

The Nethogs display includes the following columns:

  • PID: Process ID
  • USER: User running the process
  • PROGRAM: Name of the program or process
  • DEV: Network interface being used
  • SENT: Data sent by the process
  • RECEIVED: Data received by the process

This information allows you to quickly identify which processes are consuming the most bandwidth.

Advanced Features and Customizations

To get the most out of Nethogs, let’s explore some of its advanced features and customizations.

Monitoring Specific Interfaces

If you want to focus on a particular network interface, you can specify it when launching Nethogs:

sudo nethogs eth0

Replace ‘eth0’ with the name of the interface you want to monitor. You can monitor multiple interfaces simultaneously by listing them after the command:

sudo nethogs eth0 wlan0

Adjusting Refresh Rate

By default, Nethogs updates its display every second. You can change this with the -d option:

sudo nethogs -d 3

This command will refresh the display every 3 seconds.

Changing Units of Measurement

Nethogs can display traffic in different units:

  • -K: Display in KB/s (default)
  • -M: Display in MB/s
  • -G: Display in GB/s

For example:

sudo nethogs -M

This will display traffic in MB/s.

Benefits of Using Nethogs

Nethogs offers several advantages for network monitoring:

Real-Time Monitoring

Nethogs provides instant feedback on network usage, allowing you to identify bandwidth-hungry processes immediately.

Process-Specific Data

Unlike other tools that focus on protocols or subnets, Nethogs groups bandwidth by process, making it easier to pinpoint the source of network activity.

Resource Efficiency

Nethogs is lightweight and consumes minimal system resources, ensuring it doesn’t impact your system’s performance while monitoring.

Common Issues and Solutions

While Nethogs is generally reliable, you may encounter some issues. Here are common problems and their solutions:

Permission Denied Error

If you see a “Permission denied” error, ensure you’re running Nethogs with sudo privileges:

sudo nethogs

No Output or Empty Display

If Nethogs shows no output, try specifying your network interface manually:

sudo nethogs eth0

Replace ‘eth0’ with your actual interface name.

High CPU Usage

In rare cases, Nethogs may consume high CPU resources. If this occurs, try updating to the latest version or reducing the refresh rate:

sudo nethogs -d 5

Congratulations! You have successfully installed Nethogs. Thanks for using this tutorial for installing the Nethogs monitoring network traffic on Ubuntu 24.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Nethogs website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button