Photo by Filip Mroz on Unsplash

Photo by Filip Mroz on Unsplash

Bpytop command-line monitoring tool

Convenience

Article from ADMIN 66/2021
By
The bpytop command-line monitoring tool provides a variety of information via a fancy user interface and supports network monitoring and mouse- or keyboard-based control.

Linux, as a multiuser operating system, can support a large number of active processes in each user session. To keep tabs on the resources consumed by individual users, all Linux distributions offer a wide variety of tools out of the box for monitoring processes, the CPU, and memory, including well-known utilities such as top [1]. If you are interested in what is happening on the network, you can choose IPTraf [2]; if you want more convenience and functionality, you can use Wireshark [3]. Even though some of these tools have a graphical counterpart, they all run as plain text applications on the command line. In some cases, the ncurses library provides a slightly more elegant interface for user interaction.

However, bpytop [4] takes a slightly different approach. As the name suggests, the tool is written in Python and offers a similar range of functions to the previously mentioned top. However, bpytop can also deliver information on network load, and it comes with all sorts of other interesting features. For example, you can control the tool either with the keyboard or the mouse. Different themes help you integrate the tool seamlessly with your own terminal environment.

When you hear the name bpytop, you might recall the also quite well-known bashtop [5] tool. In fact, both applications come from the same developer, but whereas bashtop relies completely on Bash scripting and therefore struggles with performance by definition, bpytop is written in Python. Of course, this results in far superior performance, which is immediately noticeable when you run the program. All of the bashtop functions are also available in bpytop, so you have no good reason not to use the new tool – as long as a Python runtime environment is available.

Also, the software developer is continuing work on the next iteration of the tool. In September 2021, he announced a C++ port of the software to Linux called btop++ [6], although the OSX branch is still under development. For this article, I used bpytop because btop++ was not yet available.

Bpytop Setup

If your appetite has been whet for the bpytop tool, you can try it out on a Linux, FreeBSD, or macOS system. Almost all known Linux distributions offer a ready-made package, which you can install with the help of the respective package manager. On a Fedora system, for example, use:

dnf install bpytop

If, contrary to expectations, you cannot find a package for the software in the repositories of your Linux distribution, you can turn to the Python package manager instead:

pip3 install bpytop --upgrade

On a macOS system, the Homebrew [7] package manager can be used to install the software with a single command:

brew install bpytop

If you use FreeBSD, you can install the tool on your system with FreeBSD ports:

pkg install bpytop

As a final option, you can, of course, compile the sources from the GitHub repository [4].

Resources

After starting bpytop for the first time, you will see the default four boxes (Figure 1). These windows are named for the resources managed by the tool, with one box each for CPUs, memory, network, and processes. Each box is uniquely numbered from 1 to 4. By selecting one of these numbers, you can temporarily disable the box in question.

Figure 1: The four default windows of bpytop.

Each box provides additional options that let you customize the display and scope of information within that box. For example, in the network (net ) box, you select the device for which you want information. In the processes (proc ) box, you can use the cursor keys to change the sort order or select a specific process for which you want detailed information. The tool then shows, as an example, the status of the process, how long it has been running, and how much memory it uses. You can also send a specific signal directly from bpytop to a process (e.g., to terminate (TERM) a process cleanly or to kill it (KILL), should the process no longer be responding).

Graphical User Interface

All of these functions are also available in the top tool, but what definitely puts the two tools in different classes is the user interface. Whereas top offers a fairly spartan interface, the Python tool not only uses a whole palette of colors in the individual boxes, it also supports the use of different themes, so you can tailor the tool to your own environment (Figure 2).

Figure 2: Use the menu to adjust general settings and how the individual boxes display.

From the menu you control all settings. The options relate both to general settings, such as your choice of theme or how often you want a data update to take place, and to the boxes themselves. If you are not interested in a particular box, you can define in the menu that it no longer display the next time you start the tool.

Alternatively, all of the settings can be defined in a configuration file that the tool parses at startup. This approach is particularly useful if you want to roll out bpytop with a uniform configuration on a large number of systems. You can then distribute the file to the individual systems with a configuration management tool of your choice. By default, the tool expects a global configuration file named /etc/bpytop.conf. User-specific configurations are stored in the usual way in the .config folder: $HOME/.config/bpytop in a user's home directory.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus