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.

How to Use the modprobe Command in Linux


  • 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.

Management Options
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-dependencies Removes dependency modules.
Look up and print all module names matching an alias. Useful for debugging alias problems.
--first-time Prints 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-modversion Ignore module version on insertion or removal. Use with caution.
--force-vermagic Ignore module version magic on insertion or removal. Use with caution.

Query Options

Query options for modprobe show information about configuration and dependencies.

Query Options
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.

General Options
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

Terminal output of available modules using the find command

Note: Consider removing old kernel versions. Check out our guide on how to remove old kernels on Ubuntu.

Adding Kernel Modules With modprobe Command

1. Add a module using the modprobe command:

sudo modprobe <module name>

For example:

sudo modprobe torture

Adding a module using the modprobe command in terminal

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.

Terminal output of adding module with modprobe --first-time error

Alternatively, find the module in the active module loaded list with lmod:

lsmod | grep <module name>

For example:

lsmod | grep torture

Terminal output of lsmod and grep module

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:

Terminal output of removing module with modprobe -r --first-time error

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.

For further reading, follow our guide on how to build a Linux kernel from scratch.

Next you should also read