rmmod command is used to remove modules or unused modules from the Linux Kernel. As well as modprobe, rmmod is a part of kmod.
But in most cases, you should use modprobe -r instead of rmmod because it has a stronger impact without any dependencies.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux System queries.
In this context, we shall look into how to use the rmmod command in Linux.
To remove a Linux kernel module, run rmmod provided you are root user:
$ rmmod [options] module_name
This command provides the follow options:
You can use lsmod command to check which modules are already loaded.
Now to remove any module such as "test_module" with rmmod, simply run the following query:
$ sudo rmmod -f test_module
To confirm if nfit is removed, simply use the lsmod command:
$ lsmod | grep test_module
So, if test_module is removed, nothing will show up in the output.
rmmod also accepts deleting multiple modules as shown below:
$ rmmod module_name1 module_name2
This article covers the process of removing modules by using rmmod from the Linux kernel. In fact, 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.
Important Linux System Commands: