Your system's kernel is responsible for handling the proper working of your system regardless of the operating system that you are working with. However, the functionality of this kernel also depends on certain factors. One such factor is the kernel modules that are there to enhance the working capabilities of your kernel by supporting different device drivers, responding to system calls, and so on.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux Kernel queries.
In this context, we shall look into what Loaded Kernel Modules is and how to list their information on the system's terminal. Also, you will see the different commands that can be used to manage the kernel modules on a Linux system.
Kernel modules are pieces of code that can be loaded and unloaded into the kernel on demand. They extend the functionality of the kernel without having to reboot the system. The module can be configured as built-in to the kernel or loaded while the operating system is running. What this means is that the kernel modules can be loaded or unloaded at any time depending upon the requirements of the task that you are currently performing on your system. The loaded kernel modules are the ones that are currently loaded into your system's memory and your kernel is either using those modules or is just about to make use of them for performing a certain task.
If you want to list down the information of loaded kernel modules on your Linux Mint 20 system, then you can proceed with the following ways.
1. Listing all the Loaded Kernel Modules
In Linux Mint system, in order to list down all the loaded kernel modules, you will have to run the below command:
$ lsmod
This will display a list of all the loaded kernel modules along with their respective sizes and the modules that make use of each of these modules of our Linux system.
2. Listing a Specific Loaded Kernel Module
You can also list down a specific loaded kernel module in Linux Mint 20 if you know its name by executing the below command:
$ lsmod | grep ModuleName
Here, you can replace ModuleName with the specific name of the module that you want to list down on your system's terminal.
The specified loaded kernel module along with its size and the number of other modules associated with it will be displayed in the terminal.
3. Listing all the Information about a Specific Loaded Kernel Module
You can even list down all the information about a specific loaded kernel module in Linux Mint 20 if you know its name by running the below command:
$ sudo modinfo ModuleName
Here, replace ModuleName with the specific name of the loaded kernel module whose information you want to list down on your system's terminal.
All the information about our specified loaded kernel module will be displayed in the terminal.
modprobe is an intelligent command for listing, inserting as well as removing modules from the kernel. It searches in the module directory /lib/modules/$(uname -r) for all the modules and related files, but excludes alternative configuration files in the /etc/modprobe.d directory.
Here, you don't need the absolute path of a module; this is the advantage of using modprobe over the previous commands.
To insert a module, simply provide its name as follows:
$ modprobe speedstep-lib
To remove a module, use the -r flag like this.
$ modprobe -r speedstep-lib
Note: Under modprobe, automatic underscore conversion is performed, so there is no difference between _ and – while entering module names.
For more usage info and options, read through the modprobe man page.
$ man modprobe
This article covers how loaded kernel modules works in Linux. The kernel of a Linux system is the core that everything else in the operating system relies on. The functionality of the kernel can be extended by adding modules to it. As such, a user can fine tune their kernel settings by enabling or disabling modules. Now, you can list the information of these loaded kernel modules on your system's terminal.