In this tutorial we will learn how to install and use three great command line programs for network monitoring or in other words how to find out which programs are using bandwidth.
For this tutorial we are using Ubuntu 16.04 distribution, however you should be able to use it for all Debian and Ubuntu distributions we offer on Time4VPS.Update System
First things first. Like always, first of all, we recommend to update your server. It can be done by simply executing:
is an open source command line program that is used for monitor real time network traffic bandwidth used by each process or application.Installation
After our server is up to date we can start installation, run:
apt-get install nethogs
That's it, nethogs
is installed and ready to be used.Usage
To execute it run command as shown:
As you see above the send and received lines show the amount of traffic being used by per process. The total sent and received usage of bandwidth calculated at the bottom.
There are only a few commands that you can use to control net hogs: m
: Change displays between "kb/s", "kb", "b", and "mb".r
: Sort by traffic received.s
: Sort by traffic sent.q
Although this is a simple tool, nethogs
is a great way to associate traffic with a specific applications.IPTraf
is another great way to monitor network traffic. It provides a number of different interactive monitoring interfaces.Installation
On Ubuntu, you can install IPTraf
with the following command:
apt-get install iptrafUsage
With this menu, you can select which interface you would like to access.
For example, to get an overview of all network traffic, we can select the first menu and then "All interfaces". Here, you can see what IP addresses you are communicating on all of your network interfaces.
If you would like to have those IP addresses resolved into domains, you can enable reverse DNS lookup by exiting the traffic screen, selecting "Configure" and then selecting "Reverse DNS lookups".
You can also enable "TCP/UDP service names" to display using the names of the services instead of the port.
There are several other interfaces to investigate on your own.netstat
(network statistics) is a command-line network utility tool that displays network connections for the Transmission Control Protocol (both incoming and outgoing), routing tables, and a number of network interface and network protocol statistics.It is extremely flexible and powerful.Usage
By default, netstat
prints a list of open sockets:
Most useful command (in my option) is:
There are many other options that can change the output. Explore the help and man page for more ideas: