The Linux kernel has a modular design. Functionality is extendible with modules or drivers. Use the modprobe command to add or remove modules on Linux. The command works intelligently and adds any dependent modules automatically.

The kernel uses modprobe to request modules. The modprobe command searches through the standard installed module directories to find the necessary drivers.

This article explains how to use modprobe to add or remove kernel modules.


  • A system running Linux
  • Access to the terminal/command line
  • A user account with sudo or root privileges
modprobe Command Syntax Explained
All modprobe commands require sudo privileges. The general syntax for using modprobe is:
sudo modprobe <options> <module name>

By default, the modprobe command adds a module.
For multiple modules, expand with the option -a or -all:
sudo modprobe <options> -a <first module name> <second module name>

Options for modprobe Command
The available modprobe command options are divided into categories based on their use-case.

Management Options
Management options enable different module handling situations when inserting or removing modules with the modprobe command.

Enables multiple modules to be inserted or removed at the same time.
Remove a module. Applies --remove-dependencies as well. Useful for removing broken modules.
--remove-dependenciesRemoves dependency modules.
Look up and print all module names matching an alias. Useful for debugging alias problems.
--first-timePrints an error for already inserted or removed modules.
Ignore install/remove commands written in the module when inserting/removing a module.
Blacklist resolved alias. Blacklisted modules are not automatically loaded.
Force module insertion or removal when version errors appear. Applies both --force-modversion and --force-vermagic. Use with caution.
--force-modversionIgnore module version on insertion or removal. Use with caution.
--force-vermagicIgnore module version magic on insertion or removal. Use with caution.

Query Options

Query options for modprobe show information about configuration and dependencies.

Lists the module with the dependency files if there are any. The dependencies that install with the module have the “install” prefix.
Prints current configuration and exists.
Dumps module version dependencies.

General Options

General options configure modprobe output options, module locations, and versions.

Do not execute insert/remove but print the output. Used for debugging purposes.
--config=<file name>
Overrides the default configuration dependency (/etc/modprobe.d) with <file name>.
Use <directory> as filesystem root for /lib/modules.
Use specified kernel <version> instead of using uname.
Prints the error messages through syslog instead of standard error (stderr). When stderr is unavailable, errors get printed to syslog automatically.
Disables display of error messages.
Enables more messages to show, if available. modprobe only prints messages if something goes wrong.
Shows the modprobe version.
Shows the help message with all the commands listed.

Examples of modprobe Command

All kernel modules are listed in the /lib/modules directory system in .ko (kernel object) files by default.
Find all the available modules for the current kernel version with:
find /lib/modules/$(uname -r) -type f -name '*.ko*' | more


Adding Kernel Modules With modprobe Command
1. Add a module using the modprobe command:
sudo modprobe <module name>

For example:
sudo modprobe torture


2. Confirm the module loaded with:
sudo modprobe <module name> --first-time

The output prints an error because the module is already in the kernel.


Alternatively, find the module in the active module loaded list with lmod:
lsmod | grep <module name>

For example:
lsmod | grep torture


Removing Kernel Modules With modprobe Command
1. Remove a module using the modprobe -r command:
sudo modprobe -r <module name>

For example:
sudo modprobe -r torture

2. Confirm the module is removed by running:
sudo modprobe -r <module name> --first-time

An error message appears saying that the module is not in the kernel:


Alternatively, check the active module loaded list:
lsmod | grep <module name>

The removed module is not on the module loaded list.

The Linux kernel is created to be modular and easily extendible. Make sure to research the modules you want to add or remove to avoid problems with the kernel.