×


Rmmod Command in Linux - An Overview ?

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.


What is the syntax of rmmod command ?

To remove a Linux kernel module, run rmmod provided you are root user:

$ rmmod [options] module_name

This command provides the follow options:

  • -v, –verbose show information.
  • -f, –force remove modules that is being used or not designer to be removed.
  • -w, –wait isolate module and wait until module is longer in use.
  • -s, –syslog send errors to syslog instead of to the terminal.
  • -V, –version show rmmod's version information, and exit.


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


[Need help in Installing Open Source Software on Debian Linux System? We can help you. ]


Conclusion

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:

  • 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.