Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What Linux utility for sorting processes by network usage?
Linux provides the famous top command utility that displays information about running processes, including their time, process IDs, CPU usage, and much more. However, the top command does not sort processes by network usage, and the display order changes frequently based on CPU consumption.
When you need to monitor which processes are consuming the most network bandwidth, you need a specialized tool. NetHogs is the ideal Linux utility for sorting and monitoring processes by their network usage in real-time.
What is NetHogs?
NetHogs is a command-line network monitoring tool that displays real-time network traffic bandwidth usage for each running process or application. Unlike other network monitoring tools that show total network usage per interface, NetHogs breaks down network consumption by individual processes, making it easy to identify bandwidth-heavy applications.
Installing NetHogs
NetHogs is available in most Linux distribution repositories and can be installed using the package manager.
For CentOS and Fedora
yum install nethogs
For Ubuntu and Debian
sudo apt-get install nethogs
Using NetHogs
NetHogs requires root privileges to monitor network traffic. Run the following command to start monitoring processes by network usage −
sudo nethogs
Sample Output
PID USER PROGRAM DEV SENT RECEIVED 4071 immukul /usr/lib/sample.go wlp1s0 0.032 0.019 KB/sec 89828 immukul /usr/lib/thunderbird wlp1s0 0.029 0.017 KB/sec 15972 immukul unknown TCP wlp1s0 0.018 0.011 KB/sec 78292 immukul --skype-process wlp1s0 0.008 0.003 KB/sec
Key Features
| Feature | Description |
|---|---|
| Process-level monitoring | Shows network usage for individual processes, not just interfaces |
| Real-time updates | Continuously updates bandwidth usage statistics |
| Sorted by usage | Automatically sorts processes by network consumption (highest first) |
| Sent/Received breakdown | Displays both upload and download bandwidth separately |
Interactive Commands
While NetHogs is running, you can use these keyboard shortcuts −
q − Quit NetHogs
s − Sort by sent traffic
r − Sort by received traffic
m − Change between KB/sec, MB/sec, and GB/sec units
Conclusion
NetHogs is the most effective Linux utility for monitoring and sorting processes by network usage. It provides real-time, process-level network bandwidth monitoring with an easy-to-read interface that automatically sorts processes by their network consumption, making it invaluable for system administrators and users who need to identify bandwidth-heavy applications.
