There are many open-source network monitoring tools for Linux systems. For example, you can use command iftop to check bandwidth usage. Netstat is used to view the interface statistics report and the current running process of top monitoring system. But if you want to find a tool that can count network bandwidth utilization in real time, then Nethogs is worth a look.
Nethogs is an open source command-line tool (similar to the Linux top command) that is used to count network bandwidth usage in real time by process or program.
From the Nethogs Project website: "Nethogs is a small net top tool that, unlike most tools, slows down each protocol or the speed of each subnet and then groups the bandwidth by process. The nethogs does not need to rely on loading a particular kernel module. If a network block occurs, you can start nethogs immediately to see which PID is causing the condition. This makes it easy to figure out which program is running and suddenly takes up your bandwidth. ”
This article shows you how to install and use Nethogs to monitor network bandwidth usage by process under the Linux/centos operating system.
You can use the Yum installation command as follows:
Nethogs belongs to the Epel package, if the machine is not installed Epel need to install Epel first, the command is as follows
#rpm-UVH http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
#yum-y Install libpcap nethogs
The installation is complete as shown
Command usage: Directly at the command line terminal input nethogs default listener eth0 network card information and is refreshed once per second as
#nethogs eth0-d 5//This command means monitoring the bandwidth usage of the NIC Eth0, refreshed every five seconds
If you want to monitor both the eth0 and ETH1 interfaces, use the following command:
#nethogs eth0 eth1
If it is connected to the eth0 can be replaced by the * * * * * * * card device can be
We use XFTP to transmit a mirror to see how the bandwidth is occupied such as:
It can be clearly seen that the sshd process takes up bandwidth, and if an unknown process on the server consumes bandwidth, this tool can be detected to help solve the problem
Nethogs other parameters and usage
-D: Refresh Interval
-H: Help
-p:promiscious mode
-t:trace mode
-V: Version
Interactive commands
Here are some interactive commands for nethogs (keyboard shortcuts)
M: Modify Unit
R: Sort by traffic
S: Sort by send traffic
Q: Exit the command prompt
If you are interested in this, please scan the QR code below for free for more details
Linux/centos nethogs Monitor network bandwidth by process