modprobe Command: Tutorial & Examples

Add or remove kernel modules

The modprobe command in Linux is used to add or remove a loadable kernel module to the Linux kernel. A loadable kernel module is a piece of code that can be loaded or unloaded into the kernel at runtime, allowing the kernel to gain new functionality without the need for a full reboot.

Examples:

To add a kernel module to the kernel, use the command modprobe [module_name].

For example, to add the module nfs the command would be modprobe nfs.

To remove a kernel module from the kernel, use the command modprobe -r [module_name], for example modprobe -r nfs.

You can also use the lsmod command to see the list of the currently loaded modules.

It's worth noting that some modules can only be loaded if other modules are already loaded, and in those cases, the modprobe command will automatically load the necessary dependencies. Also, some modules can have options to be passed to them when loaded, these options can be passed to modprobe command using -o option.

Except where otherwise noted, content on this site is licensed under a CC BY-SA 4.0 license CC BY SA