Introduction – Bmon Linux command for network bandwidth monitoring
Do you need a Linux command for network bandwidth monitoring? This article explains how bmon enables you to easily monitor your network bandwidth usage. Monitoring your network bandwidth can tell you what kind of network speeds you are getting. As a result you might find an application or service consuming a large amount of bandwidth. Bmon is simple and easy to install. I use bmon because it does not require root access. For example some other tools like
iftop use libpcap which requires elevated access to get the input data. Bmon’s input modules, specifically netlink and proc can be used without root access.
Bmon – See your bandwidth usage in a terminal
Bmon is a command line tool. It provides statistics on your network utilization. By default it will display a graph as seen in the screen shot above. Before using bmon you should know which interface you want to monitor. There are multiple ways to see your network interface names. But I prefer the
ip addr command. Run the command as follows:
For example I am interested in my ethernet adapter. But I don’t know the interface name. To figure it out I run
ip addr. I only have one network adapter. And I know lo is the loop back. There
ens3 as seen in the output is my ethernet adapter.
Bmon is available in most Linux distributions. Firstly check your distro’s package management system. For example on Ubuntu, Debian and CentOS you can install it with the following commands. If your distro does not have a bmon package available you can build it from the source code.
Install bmon on Ubuntu and Debian
Installing bmon on Ubuntu or Debian is done using the apt package manager. Be sure to use the sudo command. Because installing system wide packages requires root access.
sudo apt-get install bmon
Install bmon on CentOS
On CentOS the installation is similar. But you use the yum package manager command. Again use sudo.
sudo yum install bmon
Running the bmon command to see your network usage
To use Bmon you simply run the bmon command. The default options should work on all systems.
Now you should see your network graphs in the terminal. You will want to select the interface you are interested in. For example I want to monitor
ens3. By default bmon selected lo. So I use the down arrow to move down the list. Once the
> is at
ens3 I see my ethernet stats.
To filter out certain interfaces you can use Bmon’s policy. For example if I want to exclude the loopback adapter I can use run the following command:
bmon -p '!lo'
This tells bmon to ignore the
lo interface when monitoring usage. Additionally you can explicitly specify a policy for 1 interface or a more complex policy:
bmon -p 'ens3'
bmon -p 'ens*,!lo'
Bmon input sources
To see the available input modules bmon supports, run the following command:
bmon -i list
You will see output similar to what I have below:
- Linux related articles on Linuxhit.