{"id":11805,"date":"2021-11-09T04:01:30","date_gmt":"2021-11-09T04:01:30","guid":{"rendered":"https:\/\/linuxways.net\/?p=11805"},"modified":"2021-11-16T13:13:15","modified_gmt":"2021-11-16T13:13:15","slug":"how-to-install-nethogs-on-centos","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-install-nethogs-on-centos\/","title":{"rendered":"How to Install Nethogs on CentOS"},"content":{"rendered":"<p>Have you ever been in a situation when working on your system with limited bandwidth and wondered what program is consuming your bandwidth. Nethogs is an application that can help you to find which program is responsible for it. It groups bandwidth by process on a network interface that is sending or receiving the network traffic. Nethogs is a handy application especially when there is a sudden spike in network traffic, you may use it to figure out which PID is causing this.<\/p>\n<p>In today\u2019s post, we will install Nethogs on the CentOS 8 system. Remember, you will be required to run the commands as sudo or as a root user in order to install and run Nethogs.<\/p>\n<h2>Installing Nethogs on CentOS<\/h2>\n<p>Nethogs is not available in the package repositories of CentOS. You can install Nethogs by first adding the EPEL repository. Below are the steps for installation of Nethogs on CentOS:<\/p>\n<h3>Step 1: Adding EPEL Repository<\/h3>\n<p>First, use the command below to add the EPEL repository:<\/p>\n<pre>$ sudo yum install https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-8.noarch.rpm<\/pre>\n<p>Enter sudo password. During installation, it will prompt you with <strong>y\/n<\/strong> option for proceeding with the installation procedure. If you want to proceed, press <strong>y <\/strong>and then<strong> Enter<\/strong>. <img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"401\" class=\"wp-image-11807\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-55.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-55.png 808w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-55-300x149.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-55-768x381.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/p>\n<p>Then you will be prompted with <strong>y\/n<\/strong> for the GPG key. Press <strong>y<\/strong> and then hit <strong>Enter<\/strong> to accept the key.<\/p>\n<p>Once the EPEL repository is added, you will see the below output in the end.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"109\" class=\"wp-image-11808\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-56.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-56.png 785w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-56-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-56-768x107.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/p>\n<h3>Step 2: Installing Nethogs<\/h3>\n<p>Now you can install Nethogs on your CentOS system. Use the command below to do so:<\/p>\n<pre>$ sudo yum install nethogs<\/pre>\n<p>During installation, it will prompt you with <strong>y\/n<\/strong> option for proceeding with the installation procedure. If you want to proceed, hit <strong>y <\/strong>and then<strong> Enter<\/strong>. Now the installation of Nethogs will be initiated on your machine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"816\" height=\"398\" class=\"wp-image-11811\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-58.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-58.png 816w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-58-300x146.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-58-768x375.png 768w\" sizes=\"auto, (max-width: 816px) 100vw, 816px\" \/><\/p>\n<p>Once Nethogs is installed, you will see the below output in the end.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"746\" height=\"109\" class=\"wp-image-11815\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-61.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-61.png 746w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-61-300x44.png 300w\" sizes=\"auto, (max-width: 746px) 100vw, 746px\" \/><\/p>\n<h3>Step 3: Verifying Installation<\/h3>\n<p>To verify the installation of Nethogs, use the command below:<\/p>\n<pre>$ sudo nethogs -v<\/pre>\n<p>The output below confirms that Nethogs <strong>0.8.5<\/strong> has been installed on our machine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"353\" height=\"49\" class=\"wp-image-11817\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-63.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-63.png 353w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-63-300x42.png 300w\" sizes=\"auto, (max-width: 353px) 100vw, 353px\" \/><\/p>\n<h3>Step 4: Using Nethogs<\/h3>\n<p>The general syntax to use Nethogs is as follows:<\/p>\n<pre>$ sudo nethogs [option] [interface_name]<\/pre>\n<p>Nethogs collects information from the files located in the \/proc directory. The output lists all the processes along with their PIDs that are sending and receiving the network packets on network interfaces. It then becomes easier to identify which process is consuming more bandwidth.<\/p>\n<p>If you do not specify any option or interface name, Nethogs display the bandwidth information for all the interfaces.<\/p>\n<pre>$ sudo nethogs<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"239\" class=\"wp-image-11823\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-68.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-68.png 811w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-68-300x88.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-68-768x226.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/p>\n<p>To monitor a single network interface, use the nethogs command as follows:<\/p>\n<pre>$ sudo nethogs ens37<\/pre>\n<p>If your system has multiple network interfaces and you only want to monitor specific interfaces, you can specify it as follows:<\/p>\n<pre>$ sudo nethogs ens33 ens37<\/pre>\n<p>By default, Nethogs refreshes the output every second. You can change this interval using the <strong>-d<\/strong> option. To set the refresh interval to 2 seconds, the command would be:<\/p>\n<pre>$ sudo nethogs -d2<\/pre>\n<p>When Nethogs is running, you can use some options which are as follows:<\/p>\n<ul>\n<li><strong>m<\/strong>: Pressing the <strong>m<\/strong> key at runtime, you can change the units for the displayed bandwidth (KB, B, MB and KB\/s)<\/li>\n<li><strong>r<\/strong>: Pressing the <strong>r<\/strong> key at runtime, you can sort the output by the traffic RECEIVED by the interface<\/li>\n<li><strong>s<\/strong>: Pressing the <strong>s<\/strong> option at runtime, you can sort the output by the traffic SENT from the interface<\/li>\n<li><strong>q<\/strong>: Pressing the <strong>q<\/strong> key at runtime, you can quit the shell<\/li>\n<\/ul>\n<p>For more information about Nethogs, use the <strong>-h<\/strong> option as follows:<\/p>\n<pre>$ sudo nethogs -h<\/pre>\n<h2>Uninstall Nethogs<\/h2>\n<p>You can uninstall Nethogs as follows:<\/p>\n<pre>$ sudo yum remove nethogs<\/pre>\n<p>Enter sudo password. Now it might prompt you with <strong>y\/n<\/strong> option for proceeding with the removal procedure. If you want to proceed, press <strong>y <\/strong>and then<strong> Enter<\/strong>. Nethogs will then be removed from your CentOS system.<\/p>\n<p>Nethogs lets you view the bandwidth usage by your programs in order to help you figure out which processes are hogging your network bandwidth. Using the method described above, you can conveniently install and use Nethogs on the CentOS system. In case you want to uninstall Nethogs, its procedure is also described above.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Have you ever been in a situation when working on your system with limited bandwidth and wondered what program is consuming your bandwidth. Nethogs is an application that&hellip;<\/p>","protected":false},"author":1,"featured_media":11851,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11805","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=11805"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11805\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/11851"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=11805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=11805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=11805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}