unixcop Admin

How To Use Rmmod Command On Linux With Examples

- Advertisement -

In this article, we’ll talk about how to use the rmmod command to remove modules from the Linux Kernel.

rmmod command in Linux system is used to remove a module from the kernel. Most of the users still use modprobe with the -r option instead of using rmmod.

rmmod Command

On modern Linux systems, rmmod is part of kmod, a binary that implements multiple programs used to manage Linux kernel modules.

Only users with administrative privileged can remove modules.

You can print a list of all modules loaded on your system with the lsmod command. The Kernel modules are stored in the /lib/modules/<kernel_version> directory.

Removing a module with the rmmod command is pretty simple; simply invoke the command followed by the module name:


rmmod [-f] [-s] [-v] [modulename]
rmmod module_name

The command prints message only if something goes wrong. For example, if another module uses the module, the command will print something like this:

rmmod: ERROR: Module module_name is in use by: module_name_2


root@unixcop:~# rmmod bluetooth
rmmod: ERROR: Module bluetooth is in use by: btrtl btintel btbcm bnep btusb rfcomm

To display information about what the command is doing, use the -v (–verbose) option.

If you want to remove a module used or not designed to removed, invoke the command with the -f (–verbose) option.

Warning: Using this option is extremely dangerous as it can cause a system crash.

rmmod also accepts multiple modules as arguments:

rmmod module_name1 module_name2


  • rmmod command with help option: It will print the general syntax of the rmmod along with the various options that canbe used with the rmmod command as well as gives a brief description about each option.
root@unixcop:~# rmmod --help
	rmmod [options] modulename ...
	-f, --force       forces a module unload and may crash your
	                  machine. This requires Forced Module Removal
	                  option in your kernel. DANGEROUS
	-s, --syslog      print to syslog, not stderr
	-v, --verbose     enables more messages
	-V, --version     show version
	-h, --help        show this help
  • rmmod -v: This option prints messages about what the program is being doing. Usually rmmod only prints messages only if something went wrong.


root@unixcop:~# rmmod -v bluetooth
rmmod: ERROR: Module bluetooth is in use by: btrtl btintel btbcm bnep btusb rfcomm
  • rmmod -f: This option can be extremely dangerous. It takes no effect unless CONFIG_MODULE_FORCE_UNLOAD is being set when the kernel compiled. With this option, you can remove the specified modules which are being used, or which are not being designed to be removed or have been marked as not safe.


root@unixcop:~# rmmod -f bluetooth
rmmod: ERROR: ../libkmod/libkmod-module.c:799 kmod_module_remove_module() could not remove 'bluetooth': Resource temporarily unavailable
rmmod: ERROR: could not remove module bluetooth: Resource temporarily unavailable
  • rmmod -s : This option is going to send errors to syslog instead of standard error.


root@unixcop:~# rmmod -s bluetooth
 btrtl btintel btbcm bnep btusb rfcomm
  • rmmod -V : This option will going to show version of program and then exit.
root@unixcop:~# rmmod -V
kmod version 27

Prevent a Kernel Module from Loading While Booting

When a module removed using the rmmod , the module remains unloaded until the system reboot. On the next system boot, the removed module will_be loaded.

To permanently disable a Kernel module from loading at boot-time, create a .conf file with any name inside the /etc/modprobe.d.

The syntax is:

blacklist module_name

If you want to blacklist additional modules, specify the modules on a new line, or create a new .conf file.


The rmmod command used to remove Linux kernel modules. Generally, most Linux users are using the modprobe -r command instead of rmmod.

- Advertisement -


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook