Linux rmmod command

Updated: 04/26/2017 by Computer Hope

About rmmod

rmmod removes a module from the Linux kernel.


rmmod is a simple program which removes (unloads) a module from the Linux kernel. In most cases, you will want to use modprobe with the -r option instead, as it is more robust and handles dependencies for you.

rmmod syntax

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


-v, --verbose Verbose mode; print messages about what the program is doing. If this option is not specified, rmmod will only print messages if something goes wrong.
-f, --force Force the operation to occur, no matter what. This option can be extremely dangerous, so use with extreme caution. If specified, this option can remove modules that are currently in use, which are not designed to be removed, or have been marked as unsafe.

This option will have no effect unless CONFIG_MODULE_FORCE_UNLOAD was set when the kernel was compiled.
-w, --wait Normally, rmmod will refuse to unload modules that are in use. If this option is specified, however, and you attempt to remove a module that is in use, rmmod will isolate it and wait until it is no longer in use. Nothing new will be able to use the module after it has been isolated in this way.
-s, --syslog Send errors to the syslog instead of to standard error.
-V, --version Show rmmod's version information, and exit.

rmmod examples

Warning: It is strongly recommended to use modprobe -r, rather than rmmod, to remove your kernel modules, to ensure that removal does not break any dependencies.

sudo rmmod /lib/modules/3.2.0-4-686-pae/kernel/sound/ac97_bus.ko

Remove the kernel module ac97_bus. Any other modules which depend upon this module will cease to function. Only perform this removal if you are certain of what you are doing.

depmod — Generate a list of kernel module dependencies and associated map files.
insmod — Insert a module into the Linux kernel.
lsmod — Show the status of Linux kernel modules.
modinfo — Show information about a Linux kernel module.
modprobe — Add and remove modules from the Linux kernel.