Nethogs, an unconventional yet effective network monitoring tool, has been a game-changer in the realm of network analysis. Unlike traditional tools that categorize traffic by protocol or subnet, Nethogs takes an innovative approach by grouping bandwidth utilization by process. This unique perspective allows users to identify precisely which process is eating up network resources.

Prerequisites

Before we dive into the installation process, there are a few requirements to meet:

  • A server running Debian 12 (Bookworm).
  • A fresh OS install is recommended to prevent potential issues.
  • SSH access to the server (or Terminal access if you’re on a desktop).
  • An active internet connection to download the Nethogs package.
  • A domain name pointed to your server IP (optional but recommended for a production environment).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Step 1: Update Your System

Before installing Nethogs, it is essential to update your Debian 12 system. This can be achieved by running the following commands in the terminal:

sudo apt update
sudo apt upgrade

These commands will update your package list and upgrade all your installed packages to their latest versions.

Step 2: Install Nethogs

With the system updated, we can now proceed to install Nethogs on Debian 12. The installation process involves a simple command executed in the terminal:

sudo apt install nethogs

This command will download and install Nethogs along with any necessary dependencies from the Debian repositories.

Step 3: Utilizing Nethogs

Once Nethogs is installed, you can start monitoring your network traffic. To launch Nethogs, simply type nethogs in the terminal:

sudo nethogs

This command will display a live table of your current network traffic, grouped by process. The table shows the total sent and received traffic for each running process, allowing you to see at a glance which processes are consuming your network resources.

Understanding Nethogs Output

Understanding the output of Nethogs is crucial for effective network monitoring. The table includes several columns, including the process ID, the user running the process, the network device being used, the amount of data sent and received, and the total amount of data used.

Advanced Features of Nethogs

Nethogs offers several advanced features for more detailed network monitoring.

  • Filter Traffic by Process: Append the process ID to the nethogs command:
 sudo nethogs -p <process-id>
  • Set Refresh Interval: Set the refresh interval (in seconds) with the -d option:
 sudo nethogs -d 5
  • Display Traffic in Different Units: Display traffic in different units (KB, MB, GB) with the -u option:
  sudo nethogs -u KB

Congratulations! You’ve successfully installed Nethogs on Debian 12. This tutorial has guided you through the process, from updating your system to installing and utilizing Nethogs.

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 “Cloud VPS Manage Service Offer”. Please contact us to get the best deal!