Easily Load, Unload And Blacklist Kernel Modules With kmon (TUI)

kmon is a new command line kernel manager and activity monitor. It can be used to load, unload and blacklist kernel modules, as well as show module information. The tool also shows kernel activities (hardware logs, etc.) in real time.

This command line tool is written in Rust, and it uses a text-based user interface (TUI) thanks to the tui-rs and termion libraries.

kmon linux kernel manager and activity monitor

The user interface is responsive, so it scales with the size of the terminal window in which you run it. It's made of 5 information blocks: a search bar, kernel module list, module information, kernel activities, and a block that shows the kernel release, version and platform.

You can navigate between these blocks using the keyboard: switch between blocks using ← / → or h / l. To scroll up or down inside the selected block, use the ↑ / ↓ keys, k / j or alt-k / alt-j. Load a kernel module using +, i, or insert, unload it using -, u or backspace, and blacklist a kernel module using x, b or delete. It's also possible to copy the information shown in the kernel activities block - simply press c to copy the text.

You can see all the available keyboard shortcuts by pressing ? or F1.

Among the options supported by kmon are reverse listing of the kernel module list (-r / --reverse), show Unicode symbols for the block titles (-u / --unicode), set the main color using either hex or the color name (-c / --color COLOR), and set the refresh rate of the terminal in milliseconds (-t / --tickrate MS).

You can also sort the Linux modules by their names (sort -n / --name) and size (kmon sort -s / --size).

There's not much else to say about this small command line utility, so I won't bore you with useless details that are only adjacently related. I just thought it's useful and wanted to share it with you.

You might also like: chkservice Is A systemd Unit Manager With A Terminal User Interface (New Version Available)

Download and install kmon

You can install kmon either by using the precompiled binary that can be downloaded from the tool's GitHub releases page, in which case you'll need to move the binary to /usr/local/bin/ and optionally the man page to /usr/local/man/man1/, e.g. in the folder where you've extracted the kmon release binary archive (.tar.gz):

sudo install kmon /usr/local/bin

sudo cp man/kmon.8 /usr/local/man/man1/kmon.1

Or install it using Cargo, the Rust package manager and crate host:

cargo install kmon

Arch Linux / Manjaro users also have the option of installing kmon from AUR.