The Wayback Machine - https://web.archive.org/web/20241127031518/https://www.geeksforgeeks.org/linux-monitoring-network-traffic-with-nethogs/
Open In App

Linux – Monitoring Network Traffic With nethogs

Last Updated : 19 Feb, 2021
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

NetHogs is similar to Linux top command which is an open-source command-line program, that is used for monitoring network traffic in Linux. But do you ever wanted to notice which application in your system is eating up your bandwidth, Then Nethogs is one of the good choices. Nethogs will help you find out what bandwidth an PID is taking up as Nethogs groups bandwidth by process instead of breaking the traffic down per protocol or per subnet. . It is a great choice if you want to identify which program in your Linux system is taking up more bandwidth.

Installing nethogs in Debian-based Linux:

Before installing nethogs you need to install libncurses5-dev and libpcap0.8-dev on Debian-based machines such as Kali Linux because Nethogs depends on ncurses for the text-based interface and libpcap for user-level packet capture.

sudo apt-get install libncurses5-dev libpcap0.8-dev
How to Monitor Network Traffic in Linux With nethogs

sudo apt-get install libncurses5-dev libpcap0.8-dev

Now we have to install nethogs by typing

sudo apt-get install nethogs 
How to Monitor Network Traffic in Linux With nethogs

sudo apt-get install nethogs

How to use nethogs in Debian based distros:

After installing Nethogs we have to type sudo nethogs or normal nethogs if you are already a root user because it won’t work without root privileges. 

sudo nethogs
How to Monitor Network Traffic in Linux With nethogs

sudo nethogs

Output:

How to Monitor Network Traffic in Linux With nethogs

 Nethogs Interface on my linux system

So as we can see above screenshot is showing a clear view of the program that is consuming my network bandwidth. We can easily understand from the above screenshot that nethogs display us the details about the process id of the program which is currently using the bandwidth, the name of the program which is consuming this bandwidth, the device that is being monitored, sent data details, received data details and all total.

NetHogs Command-Line Options:

-h: display available commands usage.
 

How to Monitor Network Traffic in Linux With nethogs

nethogs -h

-V: –prints Version info.
 

How to Monitor Network Traffic in Linux With nethogs

sudo nethogs -V

-d: delay for refresh rate.

You can set 3 seconds as your refresh rate, by typing the following command:-

How to Monitor Network Traffic in Linux With nethogs

sudo nethogs -d 3

 
You can also monitor specific device (wlan0) or multiple network (wlan0 and pan1) bandwidth, by typing the following command:

sudo nethogs wlan0 pan1

-p: sniff in promiscuous mode (not recommended).

It will help you to sniff in promiscuous mode but according to the nethog’s manual pages it is not recommended, but you can use it by typing the following command:

sudo nethogs -p wlan0

-t: tracemode

Trace mode will output the connections one by one, to use tracemode you have to give the following command:

How to Monitor Network Traffic in Linux With nethogs

sudo nethogs -t wlan0

And for more information, you can check the manual of nethogs by typing man nethogs and it will give output like this:

nethogs manual

NetHogs Interactive Controls:



Similar Reads

How to Install and Use vnstat Network Traffic Monitoring Tool in Linux?
VnStat is a network utility that uses a command-line interface designed for Linux. Logs of the selected interface(s) of hourly, daily, and monthly network traffic are kept, although it is not a packet sniffer. The network interface statistics that are provided by the kernel as the information source is used by VnStat, which means vnStat will not ac
2 min read
Linux iftop - Listen Network Traffic and Bandwidth
The iftop listens to network traffic on a specified network interface. The iftop is a perfect tool for remote Linux server over a ssh based session.iftop displays the bandwidth usage by a pair of hosts in the form of a table. To run this tool we must have superuser (root)permissions. Installation: Installation iftop on Debian based system like Ubun
3 min read
TCP flow Analyze and Debug Network Traffic in Linux
TCPflow is a completely free and open-source tool used for the analysis of network traffic on Linux and Unix systems. The data which is transferred during the connection is stored in a file by TCPflow in a systematic format for later study. TCPflow is almost the same as its counterparts such as Wireshark and Tcpdump, but the main difference is the
5 min read
Linux - Network Monitoring Tools
Network monitoring is using a system (hardware or software) that continuously observes your network and the data flows through it, depending on how the monitoring solution actually functions and informs the network administrator. We can keep a check on all the activities of our network easily. While Network management we need network Monitoring. Ne
4 min read
Espionage - Network Packet And Traffic Interceptor
Espionage is a free and open-source tool available on GitHub. This is a free tool that can be downloaded and installed free of cost. Espionage is a network sniffer. Espionage performs sniffing on data packets of the network. Espionage is used to intercept data packets at the time when data is passed through the network interface card. Espionage can
2 min read
How to Turn a Linux Server into a Router to Handle Traffic Statically and Dynamically
The fundamental unit used to convey information within a network is called a packet, to put it simply. The principles for transmitting data across networks that utilize TCP/IP are the same: the actual information is divided into packets that contain both the data and the address to which it should be transmitted. The act of "guiding" data across a
4 min read
Monitoring Linux Users and Processes in Real Time Using whowatch
Whowatch is a console-based, interactive user and process monitoring tool. Whowatch shows the information about the user's currently logged on the machine, in real-time. It shows the information like login name, tty, host, user's processes of logging user's. whowatch shows all processes of the selected user's in tree format. We can send the singles
2 min read
Sysdig - System Monitoring and Troubleshooting Tool For Linux
Sysdig is an open-source, cross-platform, system exploration/diagnosing and troubleshooting tool for Linux. Sysdig was written in Lua program language. Sysdig also has a simple, intuitive, powerful, and fully customizable curses UI (User Interface) called Csysdig. System state and activity from a running Linux instance are captured and saved, filte
2 min read
How to Install and Use BpyTop Resource Monitoring Tool in Linux?
It's just as critical for terminal users to be able to keep track of their system's resource use. Knowing how much of your system's resources are being used allows you to make more educated decisions about general system maintenance. Top and htop are two choices, but they only show a few device metrics including CPU and memory use. Bpytop is a term
2 min read
pydash - Python App For Monitoring Linux Server
Python and Django with Chart.js make up pydash, a lightweight web-based monitoring application for Linux. It has been tested and can run on CentOS, Fedora, Ubuntu, Debian, Arch Linux, Raspbian, and Pidora, among other popular Linux distributions. You can use it to monitor the resources on your Linux PC/server, such as CPUs, RAM, network statistics,
3 min read
Linux Sysstat Utilities For Monitoring System Performance
Sysstat is a useful utility that includes a number of programs for monitoring system resources, performance, and use. The sysstat package contains a number of programs that we all use on a daily basis. It also includes a program that can be used to collect all performance and activity data. Installing Sysstat The Sysstat package is available in the
1 min read
Mytop - Tool for Monitoring MySQL/MariaDB Performance in Linux
Mytop is a completely free and open-source tool that is used for monitoring MySQL and MariaDB databases. It was written in Perl by Jeremy Zawodny. It is almost similar to its counterpart top which is also used for monitoring purposes. Mytop provides the user with a shell through which the user can monitor different activities of the MySQL/MariaDB d
4 min read
Linux System Monitoring Commands and Tools
Monitoring the performance and health of a Linux system is essential for maintaining its stability and optimizing resource utilization. Linux provides a variety of commands and tools to facilitate system monitoring, enabling administrators to track key metrics, identify potential issues, and ensure efficient operation. Linux offers a robust set of
5 min read
Linux - Hegemon Modular System Monitoring Tool
Hegemon is a work-in-progress modular system monitor written in secure Rust programming language. This allows users to monitor utilization and hardware in a single dashboard. The system hardware and utilization information are collected through the use of variables like chan, termion, systemstat and sensor.  Some tools such as htop, CorFreq, glance
4 min read
Systemd Services: Monitoring Files and Directories
It is very important to keep our services running smoothly in Linux system administration and management. Systemd is a versatile tool used in Linux that helps us manage our services and automate our tasks. It can also act as a watch guard to monitor files and directories using "path units". In this article, we will learn how to use Systemd to monit
5 min read
Monitoring multiple ports in tcpdump
In the world of network monitoring and security, tcpdump is a widely used tool for capturing and examining network data in real time. This article explores the importance of monitoring multiple ports with tcpdump, making it easier to understand how this tool is crucial for managing networks and enhancing security. To monitor traffic on multiple por
5 min read
Iperf Command to Test Speed, Performance and Bandwidth of Network in Linux
There is a great degree of flex in how the packets are delivered and overall bit rate and packet payload size can be controlled. iperf is a tool that is used to perform network performance measurement and tuning. iperf is an open-source software which is written in C language. Jperf is a GUI version for doing the same job. The core concept work beh
2 min read
Linux - Network Information Service
The Network Information Service, or NIS (initially called YP or yellow pages), is a mainframe-client index service convention for circulating server configuration information, for example, client and host names between PCs on a PC network. Sun Microsystems built up the NIS; the innovation is authorized to essentially all other Unix merchants. Since
8 min read
Monitor Linux Daemon, Filesystem, CPU, Network and Files Using Monit
Monit is a utility tool for monitoring & managing processes, files, directories, and filesystems on a Unix System. A superpower or a super ability to start a process if it's not running, restart a process if it isn't responding, and stop a process if it uses high resources, that's what Monit(or) does in layman's terms. Monitoring is basically t
3 min read
Linux - Limit Network Bandwidth Using WonderShaper Tool
So here in this article, we are going to see how to limit a network bandwidth in Linux using WonderShaper. It is a tool which is a small bash script that enables us to limit the network bandwidth in Linux. It works as the tc command-line program as the backend for configuring traffic control in systems. Here this tool allows us to set the maximum d
3 min read
How to Monitor Processor, Memory, Network Performance using dstat in Linux?
Do you want to run a quick performance test on your Linux machine? You may want to check the dstat command. Dstat is a versatile and efficient command that combines the features of several older tools such as vmstat, netstat, iostat, and ifstat to provide useful insights into Linux system performance. You can analyze virtual memory, network connect
2 min read
PortSpider - Advance Network Port scanner on Kali Linux
PortSpider is a free and open-source tool available on GitHub. PortSpider is an Open Source Intelligence and network scanning Tool based on (OSINT). This tool can scan huge network ranges to find open and closed ports and all the vulnerable services running on the server or on the system, not only scans a single target system but can target a big n
2 min read
Virtual Private Network (VPN) Setup in Kali Linux
VPN (Virtual private network) is a technology that encrypts your internet traffic on unsecured networks to protect your online identity, hide your IP address, and shield your online data from third parties. VPNs use real-time encryption and send your internet data through a secure virtual tunnel to minimize the possibility of anyone tracking what y
5 min read
Ngrep - Network Packet Analyzer for Linux
Ngrep a network packet analyzer that is similar to the grep command, but ngrep grep the package on the network layer. This tool grep the traffic going to coming on the network interface.ngrep allow us to specify an extended regular or hexadecimal expression to match against data payloads of packets.ngrep can work on protocols like IPv4/6, TCP, UDP,
3 min read
Woof - Easily Exchange Files Over a Local Network in Linux
In order to easily share single files between Linux systems in a home network where we don't need to worry too much about security. Woof is an acronym for Web Offer One File. It is used to share files over a local area network. The recipient need not have any special software installed on his system, The shared file may be downloaded using curl, ge
3 min read
How To Use IPRoute2 Tools to Manage Network Configuration on a Linux
In computer networking, the iproute2 command line utility tool is a versatile and powerful tool for users. it provides beginner-friendly functionality to manage and configure the network. In this article, we are going to discuss each and every part of the iproute2 tool and how to implement it in our system. By the end of this article, you'll have s
4 min read
How to Set up a Network Bridge for Virtual Machine in Linux
We all have used virtual machines now or then, and they come in very handy when someone wants to run multiple instances of different operating systems in one go, or their main operating system. When you work with virtual machines it's important to connect them to a local network or to be able to access the internet through VM. So in this article, w
4 min read
How to Set up a Wireless Network in Puppy Linux
Puppy Linux is a lightweight operating system often used from a USB stick on various PCs. Connecting it to WiFi allows web access and keeping it updated. However, being compact means built-in tools are basic. Setting up wireless internet requires installing extra software initially. A quick command line process scans networks, selects yours, and sa
6 min read
How to List Network Interfaces in Linux?
In Linux, a Network Interface serves as the communication link between a computer and a network. It is a crucial component that enables the transmission and reception of data between the system and external networks, such as the Internet or local area networks. Each network interface is associated with a unique identifier, often referred to as the
5 min read
Restart Network on Kali Linux
Kali Linux, renowned for its powerful tools for penetration testing and digital forensics, often requires a stable network connection for its myriad of functions. However, there are times when the network connectivity might falter due to various reasons such as misconfiguration, hardware issues, or simply the need for a fresh start. In such cases,
4 min read
three90RightbarBannerImg