Modprobe utility is used to add loadable modules to the Linux kernel. You can also view and remove modules using modprobe command.

Linux maintains /lib/modules/$(uname-r) directory for modules and its configuration files (except /etc/modprobe.conf and /etc/modprobe.d).

In Linux kernel 2.6, the .ko modules are used instead of .o files since that has additional information that the kernel uses to load the modules. The examples shown in this article are done with modprobe on Ubuntu.

1. List Available Kernel Modules

modprobe -l will display all available modules as shown below.

$ modprobe -l

2. List Currently Loaded Modules

While the above modprobe command shows all available modules, lsmod command will display all modules that are currently loaded in the Linux kernel.

$ lsmod -l | less

3. Install New modules into Linux Kernel

In order to insert a new module into the kernel, execute the modprobe command with the module name.

Following example loads r8169 module to Linux kernel on Ubuntu.

$ sudo modprobe r8169

Once a module is loaded, verify it using lsmod command as shown below.

$ lsmod | grep r8169

The module files are with .ko extension. If you like to know the full file location of a specific Linux kernel module, use modprobe command and grep the module name as shown below.

$modprobe -l | grep r8169

Note: You can also use insmod for installing new modules and

rmmod for removing modules from the Linux kernel.

4. Load New Modules with the Different Name to Avoid Conflicts

Consider, in some cases you are supposed to load a new module but with the same module name another module got already loaded for different purposes.

If for some strange reasons, the module name you are trying to load into the kernel is getting used (with the same name) by a different module, then you can load the new module using a different name.

To load a module with a different name, use the modprobe option -o as shown below.

$ sudo modprobe r8169 -o r_8169

5. Remove the Currently Loaded Module

If you’ve loaded a module to Linux kernel for some testing purpose, you might want to unload (remove) it from the kernel.

Use modprobe -r option to unload a module from the kernel as shown below.

$ sudo modprobe -r r8169

$ cat /etc/modprobe.d/blacklist.conf

$ cat /etc/modprobe.d/alsa-base.conf

There are cases where two or more modules both support the same devices, or a module invalidly claims to support a device: thekeyword indicates that all of a particular module's internal aliases are to be ignored.There are a couple of ways toa module, and depending on the method used to load it depends on where this is configured.There are two ways to blacklist a module using, employing thesystem, the first is to use its blacklisting system inAn install primitive is the highest priority in the config file and will be used instead of the blacklisting method above, requiring this second method: