Installation and deployment of Linux tool Nethogs to monitor network bandwidth by process

Installation and deployment of Linux tool Nethogs to monitor network bandwidth by process

Overview

There are many open source network monitoring tools for Linux. For example, you can use iftop to check bandwidth usage. netstat is used to view interface statistics, and top is used to monitor the current running processes on the system. But if you want to find a tool that can count the network bandwidth utilization by process in real time, then NetHogs is worth a look.

NetHogs is a small net top tool that doesn't slow down each protocol or subnet like most tools do but groups bandwidth by process. NetHogs does not rely on loading a special kernel module. If there is a network congestion you can fire up NetHogs and immediately see which PID is causing it. This makes it easy to figure out which program is running wild and suddenly hogging your bandwidth.

Simply put, you can use nethogs to view the traffic of processes under Linux.

Installation and Deployment

1. Compile and install the nethogs dependency package. The default rpm warehouse of centos does not have the nethogs package, so we need to compile it manually. Nethogs compilation depends on 2 libraries, which need to be installed before compilation

# yum install libpcap libpcap-devel gcc* ncurses*

2. Download nethogs

Because there is a bug in 0.8 (creating socket failed while establishing local IP - are you root?), version 0.81 is used here.

# wget -c 
https://github.com/raboof/nethogs/archive/v0.8.1.tar.gz 

3. Compile and install

# tar -xvf v0.8.1.tar.gz 
# cd nethogs-0.8.1/ 
# make && make install 

#The default installation path is /usr/local/sbin/nethogs

4. Test run:

# nethogs

usage

1. Command line parameters

2. Example:

Example 1: Set the refresh rate to 5 seconds, and use -d to specify the refresh rate # nethogs -d 5 
Example 2: Monitor eth0 network bandwidth # nethogs eth0 
Example 3: Monitor eth0 and eth1 interfaces simultaneously # nethogs eth0 eth1 

3. Interactive commands:

The following are some interactive commands (keyboard shortcuts) for NetHogs:

m : Modify unit

r : Sort by traffic

s : Sort by sending traffic

q : exit command prompt

For a complete list of NetHogs command line tool parameters, refer to the NetHogs manual. To use it, enter man nethogs in the terminal.

Summarize

The above is the Linux tool Nethogs introduced by the editor to monitor network bandwidth by process. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Installation and use of Linux operation and maintenance tool Supervisor (process management tool)
  • Installation, configuration and use of process daemon supervisor in Linux
  • Detailed explanation of Supervisor installation and configuration (Linux/Unix process management tool)
  • PHP programmers play Linux series using supervisor to implement daemon process
  • How to parse and format JSON output using Linux command line tools
  • Linux debugging tools that developers and operators must look at [Recommended]
  • Best tools for taking screenshots and editing them in Linux
  • Linux process management tool supervisor installation and configuration tutorial

<<:  In-depth understanding of the use of Vue

>>:  Sharing the detailed process of setting up Mysql5.6 to allow external network access

Recommend

Descending Index in MySQL 8.0

Preface I believe everyone knows that indexes are...

Methods and steps for deploying GitLab environment based on Docker

Note: It is recommended that the virtual machine ...

61 Things Every Web Developer Should Know

Normally, you'll need to read everyone's s...

MySQL statement arrangement and summary introduction

SQL (Structured Query Language) statement, that i...

Getting the creation time of a file under Linux and a practical tutorial

background Sometimes we need to get the creation ...

Table related arrangement and Javascript operation table, tr, td

Table property settings that work well: Copy code ...

18 Amazing Connections Between Interaction Design and Psychology

Designers need to understand psychology reading n...

WeChat applet realizes chat room function

This article shares the specific code of WeChat a...

Detailed explanation of using Baidu style in eslint in React project

1. Install Baidu Eslint Rule plugin npm i -D esli...

JavaScript data transmission between different pages (URL parameter acquisition)

On web pages, we often encounter this situation: ...