- Nikhil Bhaskar
- May 16, 2021
In your network connection seems saturated and you are unsure which application is the culprit, a program called “nethogs” is a good choice for finding out.
On Ubuntu, you can install nethogs with the following command:
sudo apt-get install nethogs
We can run it by simply typing:
As you can see above all nethogs output is simple. It associates each application with its associated network traffic.
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: quit
Although this is a simple tool, nethogs is a great way to associate traffic with a specific applications.
IPTraf is another tool to monitor network traffic. It provides a number of different interactive monitoring interfaces.
On Ubuntu, you can install IPTraf with the following command:
sudo apt-get install iptraf
To run the program simply run command in terminal with sudo:
With this menu we can select which interface we would like to access.
For example, to get an overview of all network traffic we can select the first menu and then “All interfaces”. It will give a screen that looks like this:
Here we can see what IP addresses we are communicating on all network interfaces.
If we need those IP addresses resolved into domains we can enable reverse DNS lookup by exiting the traffic screen, selecting “Configure” and then selecting “Reverse DNS lookups“.
we can also enable “TCP/UDP service names” to display using the names of the services instead of the port.
The “netstat” command is a versatile tool for gathering network information. It is extremely flexible and powerful.
By default, netstat prints a list of open sockets:
If we add an “-a” option, it will list all ports, listening and non-listening:
If need filter to see only TCP or UDP connections the use “-t” or “-u” flags respectively:
See statistics by passing the “-s” flag:
Enhance and better version of df is “pydf“. It can be installed with this command:
sudo apt-get install pydf
The pydf command organises everything in neat charts with coloured output. It shows disk usage graphically with usage bars.
The “vmstat” command can output various information about our system including memory, swap, disk io, and cpu information.
We can use the command to get another view into memory usage:
We can see this in megabytes by choosing our unit with the “-S” flag:
vmstat -S M
This tool helps us break down the “-/+ buffers/cache” category of the “free” command.
We get to see how much of that block is used for buffering and how much for cache.
To get some general statistics about memory usage, type:
vmstat -s -S M
To get information about individual system processes’ cache usage, type:
vmstat -m -S M
This will give us details about what kind of information is stored in the cache.
There are many other utilities that perform simple monitoring operations