Skip to content

rmmod command in Linux

The Linux rmmod command is used to remove a kernel module from the system. This command takes the name of the module as an argument and unloads it from the kernel. It is important to note that some modules may be in use and cannot be removed. Make sure to run this command with caution to avoid disrupting the system’s functionality.

Terminal window
rmmod [options] module
OptionDescription
-f, —forceForce removal of the module
-v, —verboseVerbose mode
-w, —waitWait until the module is no longer used
-n, —syslogPrint messages to syslog
-h, —helpDisplay help message
—versionDisplay version information
ParameterDescription
moduleThe name of the module to be removed
Terminal window
rmmod usbcore

This command removes the “usbcore” kernel module.

Terminal window
rmmod -f nvidia

This command forcefully removes the “nvidia” kernel module.

Remove a kernel module and show verbose output

Section titled “Remove a kernel module and show verbose output”
Terminal window
rmmod -v nouveau

This command removes the “nouveau” kernel module and displays verbose output.

Terminal window
rmmod rtl8187 ath9k ath5k

This command removes multiple kernel modules “rtl8187”, “ath9k”, and “ath5k”.

Terminal window
rmmod i915

This command removes the “i915” kernel module along with its dependencies.

Remove a kernel module by specifying the path

Section titled “Remove a kernel module by specifying the path”
Terminal window
rmmod /lib/modules/5.4.0-52-generic/kernel/drivers/net/wireless/ath/ath10k/ath10k_pci.ko

This command removes the specified kernel module at the provided path.

Remove a kernel module and check its dependencies

Section titled “Remove a kernel module and check its dependencies”
Terminal window
rmmod -v wl

This command removes the “wl” kernel module and shows its dependencies.

Terminal window
rmmod -s rt2800usb

This command removes the “rt2800usb” kernel module silently without any output.

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

Terminal window
rmmod <module_name>

What is the purpose of the rmmod command in Linux?

Section titled “What is the purpose of the rmmod command in Linux?”

The rmmod command is used to remove kernel modules from the Linux kernel.

How can I force rmmod to remove a module in use?

Section titled “How can I force rmmod to remove a module in use?”

To force the removal of a module even if it is in use, you can add the --force option to the rmmod command. Here is an example:

Terminal window
rmmod --force <module_name>

How can I get more information about the rmmod command?

Section titled “How can I get more information about the rmmod command?”

To view the manual page for the rmmod command in Linux, you can use the following command:

Terminal window
man rmmod

Can I remove multiple modules at once with rmmod?

Section titled “Can I remove multiple modules at once with rmmod?”

Yes, you can remove multiple modules at once by providing their names as arguments to the rmmod command. Here is an example:

Terminal window
rmmod <module1> <module2> <module3>

How do I unload all unused modules with rmmod?

Section titled “How do I unload all unused modules with rmmod?”

To unload all unused modules in Linux using rmmod, you can use the following command:

Terminal window
rmmod $(lsmod | grep -oP "^(\S+)" | tail -n +2)
Section titled “Is it recommended to reboot the system after using rmmod?”

It is generally recommended to reboot the system after removing kernel modules with rmmod, especially if the removed modules were critical for system operation.

How do I check if a module is currently in use before using rmmod?

Section titled “How do I check if a module is currently in use before using rmmod?”

You can check if a module is in use before attempting to remove it with rmmod by using the following command:

Terminal window
lsmod | grep <module_name>
  • Unload a specific kernel module
  • Remove a kernel module from memory
  • Deactivate a specific driver
  • Manage kernel modules dynamically