Remove kernel modules

Sometimes you may want to remove a loaded module to reclaim the memory that the module is using or to load an updated replacement module. To do this, you can use the rmmod command. The syntax of the command is simple; you just type rmmod, followed by the name of the module you would like to remove:

linux rmmod command

Sometimes, the module you are trying to remove depends on other modules that may be loaded, like in this example:

linux rmmod command module used

As you can see from the picture above, the rmmod command lists those modules, so you can decide whether to unload them.

You can use the -f option to force module removal even if the module is marked as being in use. Note that this option has no effect unless the CONFIG_MODULE_FORCE_UNLOAD kernel option was set when the kernel was compiled.

Geek University 2022