{"id":12102,"date":"2019-03-22T10:09:32","date_gmt":"2019-03-22T10:09:32","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12102"},"modified":"2019-03-22T10:09:32","modified_gmt":"2019-03-22T10:09:32","slug":"nethogs-monitor-per-process-network-bandwidth-usage-in-real-time","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/22\/nethogs-monitor-per-process-network-bandwidth-usage-in-real-time\/","title":{"rendered":"NetHogs \u2013 Monitor Per Process Network Bandwidth Usage in Real Time"},"content":{"rendered":"<p>Linux operating systems have tons of open source network monitoring tools on the web. Say, you can use\u00a0<a href=\"https:\/\/www.tecmint.com\/install-iftop-bandwidth-monitoring-tool-in-rhel-centos-fedora\/\" target=\"_blank\" rel=\"noopener\">iftop command<\/a>\u00a0to check bandwidth usage,\u00a0<a href=\"https:\/\/www.tecmint.com\/20-netstat-commands-for-linux-network-management\/\" target=\"_blank\" rel=\"noopener\">netstat command<\/a>\u00a0to see reports on interface statistics or\u00a0<a href=\"https:\/\/www.tecmint.com\/12-top-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">top command<\/a>to watch running process on your system. But if you are really looking for something that can give you a real time statistics of your network bandwidth of per process usage, then\u00a0<strong>NetHogs<\/strong>\u00a0is the only utility you should look for.<\/p>\n<div id=\"attachment_2340\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/nethogs-3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2340\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/nethogs-3.jpg\" alt=\"Linux Network Bandwidth Monitoring\" width=\"284\" height=\"243\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">NetHogs \u2013 Network Bandwidth Monitoring<\/p>\n<\/div>\n<h4>What is NetHogs?<\/h4>\n<p><strong>NetHogs<\/strong>\u00a0is an open source command line program (similar to Linux\u00a0<strong>top<\/strong>\u00a0command) that is used for monitor real time network traffic bandwidth used by each process or application.<\/p>\n<p><strong>From NetHogs Project Page<\/strong><\/p>\n<blockquote><p>NetHogs is a small \u2018net top\u2019 tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there\u2019s suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to identify programs that have gone wild and are suddenly taking up your bandwidth.<\/p><\/blockquote>\n<p><center>This article explains you on how to install and find out real time per process network bandwidth usage with\u00a0<strong>nethogs<\/strong>\u00a0utility under\u00a0<strong>Unix\/Linux<\/strong>\u00a0operating systems.<\/center><\/p>\n<h4>Install NetHogs in RHEL, CentOS and Fedora<\/h4>\n<p>To install\u00a0<strong>nethogs<\/strong>, you must\u00a0<a href=\"https:\/\/www.tecmint.com\/how-to-enable-epel-repository-for-rhel-centos-6-5\/\" target=\"_blank\" rel=\"noopener\">turn on EPEL repository<\/a>\u00a0under your Linux systems and then run the following\u00a0<a href=\"https:\/\/www.tecmint.com\/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement\/\" target=\"_blank\" rel=\"noopener\">yum command<\/a>\u00a0to download and install nethogs package.<\/p>\n<pre># yum install nethogs<\/pre>\n<h5>Sample Output<\/h5>\n<pre>[root@tecmint ~]# yum -y install nethogs\r\n\r\nLoaded plugins: fastestmirror, refresh-packagekit\r\nLoading mirror speeds from cached hostfile\r\n * base: mirrors.hns.net.in\r\n * epel: mirror.nus.edu.sg\r\n * extras: mirrors.hns.net.in\r\n * rpmfusion-free-updates: mirrors.ustc.edu.cn\r\n * rpmfusion-nonfree-updates: mirror.de.leaseweb.net\r\n * updates: mirrors.hns.net.in\r\nSetting up Install Process\r\nResolving Dependencies\r\n--&gt; Running transaction check\r\n---&gt; Package nethogs.i686 0:0.8.0-1.el6 will be installed\r\n--&gt; Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n===========================================================================================================\r\n Package\t\t\t\tArch\t\t\t\tVersion\t\t\t\t\tRepository\t\t\t\t\tSize\r\n===========================================================================================================\r\nInstalling:\r\n nethogs\t\t\t\ti686\t\t\t\t0.8.0-1.el6\t\t\t\tepel\t\t\t\t\t\t28 k\r\n\r\nTransaction Summary\r\n===========================================================================================================\r\nInstall       1 Package(s)\r\n\r\nTotal download size: 28 k\r\nInstalled size: 50 k\r\nDownloading Packages:\r\nnethogs-0.8.0-1.el6.i686.rpm\t\t\t\t\t\t\t\t\t\t\t\t\t\t|  28 kB     00:00\r\nRunning rpm_check_debug\r\nRunning Transaction Test\r\nTransaction Test Succeeded\r\nRunning Transaction\r\n  Installing : nethogs-0.8.0-1.el6.i686                                                          1\/1\r\n  Verifying  : nethogs-0.8.0-1.el6.i686                                                          1\/1\r\n\r\nInstalled:\r\n  nethogs.i686 0:0.8.0-1.el6\r\n\r\nComplete!<\/pre>\n<h4>Install NetHogs in Ubuntu, Linux Mint and Debian<\/h4>\n<p>To install nethogs, type the following\u00a0<strong>apt-get<\/strong>\u00a0command to install nethogs package.<\/p>\n<pre>$ sudo apt-get install nethogs<\/pre>\n<h5>Sample Output<\/h5>\n<pre>tecmint@tecmint:~$ sudo apt-get install nethogs\r\n\r\n[sudo] password for tecmint: \r\nReading package lists... Done\r\nBuilding dependency tree       \r\nReading state information... Done\r\nThe following NEW packages will be installed:\r\n  nethogs\r\n0 upgraded, 1 newly installed, 0 to remove and 318 not upgraded.\r\nNeed to get 27.1 kB of archives.\r\nAfter this operation, 100 kB of additional disk space will be used.\r\nGet:1 http:\/\/in.archive.ubuntu.com\/ubuntu\/ quantal\/universe nethogs i386 0.8.0-1 [27.1 kB]\r\nFetched 27.1 kB in 1s (19.8 kB\/s)  \r\nSelecting previously unselected package nethogs.\r\n(Reading database ... 216058 files and directories currently installed.)\r\nUnpacking nethogs (from ...\/nethogs_0.8.0-1_i386.deb) ...\r\nProcessing triggers for man-db ...\r\nSetting up nethogs (0.8.0-1) ...<\/pre>\n<h4>Using NetHogs Utility<\/h4>\n<p>To run the nethogs utility, type the following command under red-hat based systems.<\/p>\n<pre># nethogs<\/pre>\n<p>To execute it, you will must have root permissions, so run with\u00a0<strong>sudo<\/strong>\u00a0command as shown.<\/p>\n<pre>$ sudo nethogs<\/pre>\n<h5>Sample Previews:<\/h5>\n<div id=\"attachment_2337\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/NetHogs1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2337\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/NetHogs1.png\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/NetHogs1.png 631w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/NetHogs1-300x212.png 300w\" alt=\"Install Nethogs in Linux\" width=\"631\" height=\"448\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">NetHogs Preview on CentOS 6.3<\/p>\n<\/div>\n<div id=\"attachment_2339\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/nethogs-2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2339\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/nethogs-2.jpg\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/nethogs-2.jpg 600w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/03\/nethogs-2-300x225.jpg 300w\" alt=\"Install nethogs in Ubuntu\" width=\"600\" height=\"450\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">NetHogs Preview on Ubuntu 12.10<\/p>\n<\/div>\n<p>As you see above the\u00a0<strong>send<\/strong>\u00a0and\u00a0<strong>received<\/strong>\u00a0lines show the amount of traffic being used by per process. The total\u00a0<strong>sent<\/strong>\u00a0and\u00a0<strong>received<\/strong>\u00a0usage of bandwidth calculated at the bottom. You can sort and change the order by using the interactive controls discussed below.<\/p>\n<h4>NetHogs Command Line Options<\/h4>\n<p>Following are the\u00a0<strong>nethogs<\/strong>\u00a0command line options. Using \u2018<strong>-d<\/strong>\u2018 to add a refresh rate and \u2018<strong>device name<\/strong>\u2018 to monitor specific given device or devices bandwidth (default is\u00a0<strong>eth0<\/strong>). For example, to set\u00a0<strong>5 seconds<\/strong>\u00a0as your refresh rate, then type the command as.<\/p>\n<pre># nethogs -d 5<\/pre>\n<pre>$ sudo nethogs -d 5<\/pre>\n<p>To monitor specific device (<strong>eth0<\/strong>) network bandwidth only, use the command as.<\/p>\n<pre># nethogs eth0<\/pre>\n<pre>$ sudo nethogs eth0<\/pre>\n<p>To monitor network bandwidth of both\u00a0<strong>eth0<\/strong>\u00a0and\u00a0<strong>eth1<\/strong>\u00a0interfaces, type the following command.<\/p>\n<pre># nethogs eth0 eth1<\/pre>\n<pre>$ sudo nethogs eth0 eth1<\/pre>\n<h5>Other Options and Usage<\/h5>\n<pre>-d : delay for refresh rate.\r\n-h : display available commands usage.\r\n-p : sniff in promiscious mode (not recommended).\r\n-t : tracemode.\r\n-V : prints Version info.<\/pre>\n<h4>NetHogs Interactive Controls<\/h4>\n<p>Following are some useful interactive controls (<strong>Keyboard Shortcuts<\/strong>) of nethogs program.<\/p>\n<pre>-m : Change the units displayed for the bandwidth in units like KB\/sec -&gt; KB -&gt; B-&gt; MB.\r\n-r : Sort by magnitude of respectively traffic.\r\n-s : Sort by magnitude of sent traffic.\r\n-q : Hit quit to the shell prompt.<\/pre>\n<div class=\"google-auto-placed ap_container\">For a full list of\u00a0<strong>nethogs<\/strong>\u00a0utility command line options, please check out the nethogs man pages by using command as \u2018<strong>man nethogs<\/strong>\u2018 or\u00a0<strong>\u2018sudo man nethogs<\/strong>\u2018 from the terminal. For more information visit the\u00a0<a href=\"http:\/\/nethogs.sourceforge.net\/\" target=\"_blank\" rel=\"nofollow noopener\">Nethogs project<\/a>\u00a0home page.<\/div>\n<p><a href=\"https:\/\/www.tecmint.com\/nethogs-monitor-per-process-network-bandwidth-usage-in-real-time\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux operating systems have tons of open source network monitoring tools on the web. Say, you can use\u00a0iftop command\u00a0to check bandwidth usage,\u00a0netstat command\u00a0to see reports on interface statistics or\u00a0top commandto watch running process on your system. But if you are really looking for something that can give you a real time statistics of your network &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/22\/nethogs-monitor-per-process-network-bandwidth-usage-in-real-time\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;NetHogs \u2013 Monitor Per Process Network Bandwidth Usage in Real Time&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12102","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12102"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12102\/revisions"}],"predecessor-version":[{"id":12103,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12102\/revisions\/12103"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}