What Linux utility for sorting processes by network usage?

LinuxOperating SystemOpen Source

Linux provides the famous top command utility that provides us with all the information about the processes, their time, their respective IDs, how much CPU chunk they are consuming and much more. The only issue with that is the processes are not sorted in any order and the order changes frequently.

There are certain cases where we would like the output to be in a sorted manner somehow, like sorted in the sense that the process which is using the most network will be at the top.

One such command line program that we can use that will provide us the desired output is NetHogs.

NetHogs is a command line program that is used to monitor real time network traffic bandwidth used by each process or application.

Installing NetHogs

For CentOS and Fedora

yum install nethogs

For Ubuntu and Debian

sudo apt-get install nethogs

Now that we have nethogs installed we can make use of it by the commands shown below −

For red-hat based systems

nethogs

To execute it, it is necessary to provide the root permissions, so we run it with the sudo command as shown below −

Command

sudo nethogs

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
raja
Published on 31-Jul-2021 12:24:46
Advertisements