How to Monitor Data Usage on Linux using nethogs

How to Monitor Data Usage on Linux using nethogs

We will use command line program NetHogs which is used for monitoring real time data used by each process or application. As Linux is known for its flexibility and freedom it provides you can do this in just few easy steps.

Instead of breaking the traffic down per protocol or per subnet, like most such tools do, Nethogs groups bandwidth by process – and does not rely on a special kernel module to be loaded. So if there’s suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID(Process ID) is causing this, and if it’s some kind of spinning process, kill it.

This will save your bandwidth and even some potential risk of data breach!

Here are the steps to follow:-

Installing nethogs

$ sudo apt install nethogs

Running nethogs

To run nethogs in debian based distors use sudo otherwise, type nethogs after giving root permission.

$ sudo nethogs

Output and exit:-

The following output will be shown. You can see the users and also which process is taking the data, this way if something looks shady you can easily kill that process.

How to Monitor Data Usage on Linux using nethogs

Exiting Nethogs

To exit nethogs press Ctrl+c.

To see which other commands you can use with nethogs type nethogs -h

How to Monitor Data Usage on Linux using nethogs

You can also sort the sent and receive traffic.

Deleting NetHogs

For deleting we’ll use apt remove nethogs.

$ sudo apt remove nethogs

For code nethogs GitHub repository

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *