Earlier in one of the post I already explained about process management in Linux and how to monitor and determine resource usage of each command such as process time, RAM, etc. In this post, I will demonstrate about how to get list of processes which use network bandwidth. In Linux many applications and commands are available either in GUI or command line for network management. What I explain here is really small part of the ocean (network commands). For getting list of processes that use bandwidth, you can use ‘nethogs’, ‘iftop’, ‘netstat’ and other commands. Here I cover just three of them which mean ‘nethogs’, ‘iftop’, and ‘netstat’.
This command is similar to ‘top’ command in process management but it monitors traffic on network based on assigned network card. For installing nethogs type the following command in command line of Debian based distros.
$ sudo apt-get install nethogs
After installing it, you could run it like below command,
$ sudo nethogs -wlan0
First of all keep in your mind that for executing this command you should have root permission and in above command traffic of ‘wlan0’ network (wireless card) is monitored. This command shows live overall traffic consumption of processes that use network and updates statistics each second exactly like top command.
This command is equal command to ‘top’ command except that this command is for network monitioring. For installing iftop command type the following command in console.
$ sudo apt-get install iftop
Like nethogs command, this command also needs root permission to execute. In addition, if you do not identify your network card, by default the command monitors ‘eth0’ card. Therefore, for using iftop to listen to another network follow below example,
$ sudo iftop -i wlan0
In comparison with nethogs, iftop gives you more details about network traffic and in addition, this command monitors those system processes that use network as well not like nethogs that by default just monitor user processes.
Netstat is also useful tool to monitor network traffic, however it does not have live monitor ability and whenever you run this command it just gives list of processes that use network and quit. The good point about this command is that, netstat does not need root permission to run and is suitable for users who do not have access to root account. In most of Linux distros this command is also pre-installed but if it is not installed you can install it by following command,
$ sudo apt-get install netstat
For getting list of processes follow below example,
$ netstat -ntp
send your idea and information to firstname.lastname@example.org