GNU/Linux system administrator involved into a huge number of tasks. The most significant of these include checking the OS’s network usage. GNU/Linux has many tools that allow you to monitor and analyze the network of both the desktop PC and the corporate server.
Such tools are presented with a graphical interface or functioning only through the command line (sometimes developers combine this). In each of these cases, there are advantages and disadvantages. The most important, but conditional difference: graphical utilities of the YaST or KDE System Guard type are usually distinguished by ease of use and simplicity, while console utilities are distinguished by their flexibility and informativeness, but are slightly more difficult to use.
Most often it is the server that has to be administered, and it usually has a console only, even without a window manager. By the way, working in the console, you can better understand how the specified tool works, even if it has a window version.
This article shares the list of the most common and useful console utilities for network monitoring.
This program is especially popular with GNU/Linux administrators, as its capabilities in network analysis are simply amazing. It can be used only in console interactive mode, which allows you to see quite clearly and in detail what is happening with network packets.
The program is in the software store of most distributions.
To install it, run the following command in the console:
|Debian-based||sudo apt install iptraf|
|“Red Hat”-based||sudo yum install iptraf|
|Arch-based||sudo pacman -S iptraf-ng|
To run the utility, execute the iptraf command (or iptraf-ng, if it is an Arch-like distribution) with superuser privileges, after which the main program window will appear.
A list of available tools for complete network monitoring is provided.
Note! At the bottom of the program window, additional information about the selected tool, as well as keyboard navigation tips are displayed.
For example, to review network connections and traffic, select “IP Traffic monitor” and select the desired network interface.
After a while, the screen will display the IP addresses that interact with this network card, as well as the information about the transmitted packages, their direction and volume, expressed in bytes.
This program has a simpler look. It shows less information than iptraf, but it is also useful and informative with the features that it provides when checking network usage on Linux.
To install it, use one of the following commands:
|Debian-based||sudo apt install iftop|
|“Red Hat”-based||sudo yum install iftop|
|Arch-based||sudo pacman -S iftop|
The program is started by the iftop with root privileges, after which the listening will have the default network interface. You can manually change the listening object using the -i flag, specifying the name of the network interface after it.
Details of each connection are shown here, but the utility does not identify the object that creates the packages.
Detailed information about the program can be found through the man iftop command.
An extremely simple console tool that shows the transmission speed of packages in streaming mode, including the current, average, minimum, maximum, as well as the total amount of transmitted and received information.
It can be installed by one of the commands:
|Debian-based||sudo apt install nload|
|“Red Hat”-based||sudo yum install nload|
|Arch-based||sudo pacman -S nload|
To run it, you need to use the nload command.
The first block displays information about the incoming connection, and the second — about the outgoing connection.
Unlike other network tools, nethogs shows the identifier of the process (PID) involved in sending or receiving network packages, and the user on whose behalf it was launched.
The installation of the utility can be done using one of these commands:
|Debian-based||sudo apt install nethogs|
|“Red Hat”-based||sudo yum install nethogs|
|Arch-based||sudo pacman -S nethogs|
It is launched with the command by the name of the package.
This program displays detailed statistics for all network interfaces, including a pseudo graphic representation of data.
It can be installed from the software store of most distributions:
|Debian-based||sudo apt install bmon|
|“Red Hat”-based||sudo yum install bmon|
|Arch-based||sudo pacman -S bmon|
The program starts by the name of the package.
To display help, press ?. To close the program, press q.
This utility has features that will be useful in special cases. This is a daemon that collects network operation data into a log. After that, you can do a load analysis for the specified period.
First you need to install the utility from the standard repository:
|Debian-based||sudo apt install vnstat|
|“Red Hat”-based||sudo yum install vnstat|
|Arch-based||sudo pacman -S vnstat|
Then you need to start the daemon:
sudo systemctl start vnstat
Now you can check its work status:
systemctl status vnstat
The program will collect data for some time. Viewing statistics is available by the vnstat command.
Also, statistics can be monitored in streaming mode using the -l flag.
Another small program that displays network load in streaming mode. It works with all available network interfaces.
To install it, use one of the commands:
|Debian-based||sudo apt install bwm-ng|
|“Red Hat”-based||sudo yum install bwm-ng|
|Arch-based||sudo pacman -S bwm-ng|
It starts by the name of the package.
The program is quite functional (more on this you can find in man bwm-ng). One of the most convenient features is an ability to export information to a file of various types, including csv and html, for its further analysis.