View network bandwidth for each process in Linux using Nethogs

Have you ever been in the saturation that your Linux server is using a lot of network bandwidth, but it’s a guesswork to find the process using it all?
I just stumbled upon this tool, it’s not a new tools, but it’s extremely useful!
Let’s say you have a server running apache, mysql, ftp, btsync and a lot of other network services. and somehow that server is using up 100Mbit constantly. You want to find out what it is but only got tools like iftop, atop, iptraf and others which are all great tools, but they only show which connections are using the network bandwidth.

nethogs is the program you need.

Nethogs will show you all the processes (including name and pid) using network traffic, and exactly how much.
Using this command, you can spot the process using up all your bandwidth in just seconds!

Installation

The program is not default installed in most distro’s, so you have to install it yourself using your package manager:
Arch linux:

pacman -S nethogs

Debian:

apt-get install nethogs

CentOS/RHEL:

yum install nethogs

Running nethogs

Running nethogs is as easy as it gets. Just run it as root:

nethogs

You will start seeing output like the following, in this example i started a download of a big iso file using wget:
nethogs_example
Thats it, a good tool to have in your collection! have fun using this in the future when some server is hogging all your internet.

Leave a Reply

Your email address will not be published.