How to Monitor Network Load From the Command Line in Linux

If you are a network administrator, you’surely know the importance of network traffic monitoring. While there is some excellent GUI-based software available for this, if you’re dealing with command line and are looking for a command-line alternative, I’d suggest you try slurm.

In this article, we will discuss the slurm command along with the features it provides.

Described by its man page as “yet another network load monitor”, Slurm is a generic network load monitor which shows device statistics together with a nice ascii graph – it supports multiple types of graphs.

For those interested in its origins, the project started as a FreeBSD port of the Linux ppp link monitor called “pppstatus.” Aside from Linux, the command works on many other platforms including FreeBSD, OpenBSD, NetBSD, Solaris, HP-UX, MicroBSD, and Mac OS X.

Users of Debian-based systems, like Ubuntu, can easily download and install this utility using the following command:

sudo apt-get install slurm

Alternatively, you can also download its source code  and install manually.

Here are some examples of how the slurm command can be used:

Note: all examples presented in this article are tested on Ubuntu 14.04.

Default output

To use the slurm command, the first thing that you have to do is let it know which network interface you want to monitor, something you can do by passing the interface name as an argument to the -i command line option.

For example, in my case, I wanted to monitor the “wlan0” interface, so I executed the command in the following way:

slurm -i wlan0

and the following output was produced:

slurm-default-output

As can be seen in the above screen shot, the command produced information related to network traffic both in text as well as in form of a graph, which scrolls from left to right according to network usage.

Although the command’s man page, as well the project page, does not provide any information about the graph as well as the data it depicts, it’s apparent that the green X’s indicate downloads and the Red X’s indicate uploads. Each column in the graph depicts network load (download + upload) at any given second, which means the more X’s in a particular column, the more the network load at that second in time.

Other graph modes

Aside from the default graph mode, the command also offers classic as well as split and large split graph mode.

To start the command with classic/combined graph, use the -c command line option:

slurm -i wlan0 -c

slurm-classic-combined-graph-mode

Similarly, to start the command in the split graph mode, use the -s command line option:

slurm -i wlan0 -s

slurm-split-graph-mode

Finally, to start the command in large split graph mode, use the -l command line option:

slurm -i wlan0 -l

slurm-large-split-graph-mode

Change the delay between screen updates

By default, the command updates the output after one second. However, you can change this by using the -d command line option. For example, to change the delay to 3 seconds, I used the following command:

slurm -i wlan0 -d 5

Slurm is lightweight and easy-to-use command line tool for monitoring network activity. Although it does not provide a lot of features, it delivers what it claims. Also, if you want, you can try integrating it with tools like Conky to make the most of it.

Have you ever used the slurm command? How was your experience? Share your thoughts in the comments below.