Skip to content

modprobe command in Linux

The modprobe command in Linux is used to manage kernel modules. It allows users to insert, remove, and manipulate modules in the Linux kernel. Modprobe can also automatically load dependencies for a module being added. This command is essential for managing hardware drivers and configuring the kernel. By understanding the modprobe command, users can efficiently handle kernel modules to optimize system performance.

Terminal window
modprobe [options] module_name
OptionDescription
-cUse the specified configuration file
-vShow verbose information
-nDry-run mode, show actions but do not execute them
-qQuiet mode, suppress normal output
-rRemove the specified module
-aInsert module even if already loaded
-sLog to the system log for each request
-tSet timeout value for network request completion
-DConsider dependencies during insertion and removal
-SCompute and resolve all module symbols
ParameterDescription
module_nameName of the module to insert or remove
Terminal window
modprobe <module_name>

Load the specified module into the Linux kernel.

Terminal window
modprobe -r <module_name>

Unload the specified module from the Linux kernel.

Terminal window
modprobe -l

Display a list of modules that are currently loaded in the Linux kernel.

Terminal window
modprobe -c | grep <module_name>

Retrieve detailed information about a specific module.

Terminal window
modprobe <module_name> param1=value1 param2=value2

Load the module with specific parameters provided as key-value pairs.

Terminal window
modprobe -c | grep -A <number_of_lines> depends <module_name>

Display the dependencies of a specific module by searching the module config file.

Terminal window
echo "blacklist <module_name>" | sudo tee /etc/modprobe.d/blacklist.conf

Create a blacklist configuration file to prevent a module from autoloading.

Terminal window
echo "install <module_name> /bin/true" | sudo tee -a /etc/modprobe.d/blacklist.conf

Prevent a specific module from loading during boot by setting the install command to /bin/true in the blacklist configuration file.

To use the modprobe command in Linux, execute the following command:

Terminal window
modprobe --option <value>

The modprobe command is used in Linux to add or remove kernel modules to the Linux kernel dynamically.

Terminal window
modprobe <module_name>

How can I list all currently loaded modules with modprobe?

Section titled “How can I list all currently loaded modules with modprobe?”

To list all currently loaded modules using modprobe, run the following command:

Terminal window
lsmod

You can remove a module using modprobe in Linux with the following command:

Terminal window
modprobe -r <module_name>

Can I add multiple modules at once with modprobe?

Section titled “Can I add multiple modules at once with modprobe?”

Yes, you can add multiple modules at once using modprobe by listing them all in a single command:

Terminal window
modprobe <module1> <module2> <module3>

How can I get more information about a specific module using modprobe?

Section titled “How can I get more information about a specific module using modprobe?”

To get more information about a specific module using modprobe, you can use the modinfo command. For example:

Terminal window
modinfo <module_name>

How do I check if a module is currently loaded with modprobe?

Section titled “How do I check if a module is currently loaded with modprobe?”

You can check if a module is currently loaded with modprobe by using the following command:

Terminal window
lsmod | grep <module_name>
Section titled “Is it possible to force loading a module with modprobe even if it might not be recommended?”

Yes, you can force loading a module with modprobe even if it might not be recommended by using the --force option. For example:

Terminal window
modprobe --force <module_name>

How do I see the dependencies of a module with modprobe?

Section titled “How do I see the dependencies of a module with modprobe?”

To see the dependencies of a module using modprobe, you can use the following command:

Terminal window
modprobe --show-depends <module_name>
  • Loading a specific kernel module
  • Unloading a kernel module
  • Listing currently loaded kernel modules
  • Adding or removing kernel module dependencies
  • Setting module options or parameters