In this tutorial, we will be covering the process of installing and using
nethogs on CentOS 6x x64.
nethogs is a network monitoring tool which allows Network and System Administrators to quickly identify the root cause of traffic-consuming processes that could be negatively affecting server’s performance.
Unlike similar tools,
nethogs sorts bandwidth-consuming processes by
process instead of
subnet, thus allowing the Network and/or Systems Administrator to quickly identify the source of the traffic increase and isolate it if needed.
nethogs package is available under the EPEL Yum Repository:
sudo yum -y install epel-release sudo yum clean all sudo yum -y update sudo yum -y install nethogs
The above command will launch
nethogs which will automatically begin monitoring bandwidth usage on the default Network Interface.
It is possible to specify the Network Interface which you want to monitor with
sudo nethogs eth1
It is also possible to use
nethogs to monitor multiple interfaces simultaneously:
sudo nethogs eth0 eth1
nethogs interface allows you to easily find the most consuming program on the specified device and its ID (PID or Process ID), user, and bandwidth usages.
On the Nethogs interface, press
m to make the bandwidth usages toggle between total traffic and instant speed.
You can press
q to quit the process.
Set the refresh interval in seconds (the default value is 1 second):
sudo nethogs -d 3
Display the version number:
Run Nethogs in tracemode:
sudo nethogs -t
In tracemode, the command outputs the connections one by one.
Run Nethogs in bughunt mode:
sudo nethogs -b
(Not recommended) Run Nethogs in promiscuous mode:
sudo nethogs -p
Show help for Nethogs: