Nethogs Real-time statistics network bandwidth utilization in Linux

Source: Internet
Author: User
Tags centos linux mint

What is Nethogs?

Nethogs is an open source command-line tool (similar to the Linux top command) for real-time statistics of network bandwidth usage by process or program.

From Nethogs Project website:

Nethogs is a small ' net top ' tool that does not slow down each protocol or the speed of each subnet, as most tools do, but to group bandwidth by process. Nethogs Nethogs does not need to rely on loading a particular kernel module. If there is a network blocking you can start nethogs immediately see which PID is causing this condition. It's easy to find out which program is running and then suddenly taking up your bandwidth.
This article explains how to install and use Nethogs to monitor network bandwidth usage by process under the Unix/linux operating system.

Install the nethogs under Rhel,centos and Fedora:

To install Nethogs, you must enable the Epel source under the Linux you use. Then run the following yum command to download the install Nethogs package.


1
# yum Install Nethogs
Sample output


[Root@tecmint ~]# yum-y Install Nethogs

Loaded Plugins:fastestmirror, Refresh-packagekit
Loading mirror speeds from cached hostfile
* base:mirrors.hns.net.in
* epel:mirror.nus.edu.sg
* extras:mirrors.hns.net.in
* rpmfusion-free-updates:mirrors.ustc.edu.cn
* Rpmfusion-nonfree-updates:mirror.de.leaseweb.net
* updates:mirrors.hns.net.in
Setting up Install Process
Resolving dependencies
--> Running transaction Check
---> Package nethogs.i686 0:0.8.0-1.el6 would be installed
--> Finished Dependency resolution

Dependencies resolved

===========================================================================================================
Package Arch Version Repository Size
===========================================================================================================
Installing:
Nethogs i686 0.8.0-1.el6 Epel k

Transaction Summary
===========================================================================================================
Install 1 Package (s)

Total Download size:28 k
Installed size:50 K
Downloading Packages:
nethogs-0.8.0-1.el6.i686.rpm | MB 00:00
Running Rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
installing:nethogs-0.8.0-1.el6.i686 1/1
verifying:nethogs-0.8.0-1.el6.i686 1/1

Installed:
nethogs.i686 0:0.8.0-1.el6

complete!
Install Nethogs under Ubuntu, Linux Mint and Debian:

Type the Apt-get command to install the Nethogs package

$ sudo apt-get install Nethogs
Sample output


tecmint@tecmint:~$ sudo apt-get install nethogs

[sudo] password for tecmint:
Reading Package Lists ... Done
Building Dependency Tree
Reading state information ... Done
The following NEW packages would be installed:
Nethogs
0 upgraded, 1 newly installed, 0 to-Remove and 318 not upgraded.
Need to get 27.1 KB of archives.
After this operation, MB of additional disk space would be used.
Get:1 http://in.archive.ubuntu.com/ubuntu/quantal/universe nethogs i386 0.8.0-1 [27.1 KB]
fetched 27.1 kB in 1s (19.8 kb/s)
Selecting previously unselected package nethogs.
(Reading database ...) 216058 files and directories currently installed.)
Unpacking Nethogs (from .../nethogs_0.8.0-1_i386.deb) ...
Processing triggers for man-db ...
Setting up Nethogs (0.8.0-1) ...
Nethogs usage

Start the Nethogs tool by typing the following command based on the Redhat system.

# Nethogs
To perform nethogs you must have root permissions, as shown in the sudo command

$ sudo nethogs
Sample preview:

Nethogs Preview under CentOS 6.3

Nethogs Preview under Ubuntu 12.10

As shown in the figure above, the Send column and received columns show the flow statistics per process. The total transceiver bandwidth is at the bottom and can be sorted with interactive commands, which are discussed below:

Nethogs Command Line arguments

The following is the parameter of the Nethogs command line, with '-d ' to add the refresh frequency parameter, ' device name ' is used to detect the bandwidth of a given or some device (default is eth0). For example: Set the refresh rate for 5 seconds, type the following command:

# nethogs-d 5


$ sudo nethogs-d 5
If the network bandwidth used only for monitoring devices (eth0) can use the following command:

# nethogs Eth0


$ sudo nethogs eth0
If you want to monitor both the eth0 and ETH1 interfaces, use the following command:

# nethogs Eth0 eth1


$ sudo nethogs eth0 eth1
Other parameters and usage

-d:delay for refresh rate.
-h:display available commands usage.
-p:sniff in promiscious mode (not recommended).
-t:tracemode.
-v:prints Version Info.
Nethogs Interactive Control

Here are some useful interactive controls for Nethogs (keyboard shortcuts)

-m:change the units displayed for the bandwidth in units like Kb/sec-> KB-> MB.
-r:sort by magnitude of respectively traffic.
-s:sort by magnitude of sent traffic.
-q:hit quit to the shell prompt.
To nethogs the complete list of parameters for the command-line tool, refer to the Nethogs manual by typing ' man nethogs ' or ' sudo man nethogs ' in the terminal,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.