modprobe, lsmod, modinfo Command Tutorial With Examples To Load, List Linux Kernel Modules
What makes an Operating system Linux Distribution? All Linux distributions use same kernel named Linux Kernel. Linux kernel provides operating system services, hardware management, process management, memory management etc.
Linux kernel is a monolithic kernel which means single executable all in one. But the operating systems should provide dynamic environments to comply user needs. Linux provides mechanism to load some drivers, features etc. This is called kernel modules. In this tutorial we will look kernel modules operations with
modprobe command. Most of the examples in this tutorial requires root privileges.
$ modprobe -h
List Available Kernel Modules
Linux kernel came with a lot of default kernel modules. These modules are loaded according to requirements and kernel config provided by the distribution. There is also an option to add new kernel modules externally to the Linux. We can list all of these modules with
OR another way
$ cat /proc/modules
List Loaded Modules
As we know kernel modules are loaded or unloaded. We can list only installed kernel modules by using previous command. but in this command we need some external help. We will use
egrep to filter installed kernel modules.
$ lsmod | egrep -v "\s0"
Get Information About Kernel Module
Kernel modules can get different parameter for configuration purposes. Also there are different type of information. Here are some of them which can be listed with modinfo command.
filenamewhat is modules file name and the path
licensemodules license type like GPL,GPL2,Apache,TM
descriptionshort description abount the kernel module
dependsspecify what other kernel modules are needed to load this module
intreespecifys if this kernel module is maintained in kernel git repository
vermagicspecifies the version of the kernel module
parmspecifies parameter that can be used to configure this kernel module.
$ modinfo qxl
Load or Install New Kernel Modules
Generally Linux operating system automatically loads related kernel modules. There is no need to load them manually in most situations. But some times manual operation may be needed to load kernel modules. We will install module named
ipx by using
insmod in this example.
$ modprobe ipx
Remove or Unload Loaded Kernel Module
We can remove kernel modules. We will use
modprobe command againg with
-r option by providing the kernel module name. In this example we unload
ipx kernel module
$ sudo modprobe -r ipx