Skip to content

What is insmod Linux command?

The Linux insmod command is used to insert a module into the Linux kernel. It allows users to add new functionalities to the kernel on-demand without rebooting the system. The insmod command requires the path to the module to be specified, and it will insert the module along with its dependencies into the kernel.

Terminal window
insmod [options] <module_name>
OptionDescription
-fForce the module to load
-sLog to the system log when the module is loaded
-vDisplay verbose information
-m Specify the name of the module
ParameterDescription
module_nameThe name of the module to be loaded into the kernel
Terminal window
insmod my_module.ko

This command loads the specified kernel module “my_module.ko” into the Linux kernel.

Terminal window
insmod my_module.ko my_param=123

Loads the kernel module “my_module.ko” with the parameter “my_param” set to a value of 123.

Terminal window
insmod -d my_module.ko

Loads the kernel module “my_module.ko” into the kernel and displays debug messages during the process.

Terminal window
insmod -f my_module.ko

Forces the loading of the kernel module “my_module.ko”, even if it may not be fully compatible.

Terminal window
insmod /path/to/my_module.ko

Loads the kernel module located at the specified path “/path/to/my_module.ko” into the Linux kernel.

To use the insmod command in bash, execute the following command:

Terminal window
insmod <module_name>.ko

The syntax for the insmod command in Linux is as follows:

Terminal window
insmod [options] <module_name>.ko

How can I load a specific module with insmod?

Section titled “How can I load a specific module with insmod?”

To load a specific module using insmod, specify the full path to the module file, like this:

Terminal window
insmod /path/to/module/my_module.ko

How do I check the status of a module after using insmod?

Section titled “How do I check the status of a module after using insmod?”

To check the status of a module that was loaded using insmod, you can use the lsmod command like this:

Terminal window
lsmod | grep <module_name>

Yes, you can unload a module that was loaded with insmod using the rmmod command. For example:

Terminal window
rmmod <module_name>

If you need to force insmod to load a module, you can use the -f flag like this:

Terminal window
insmod -f <module_name>.ko

How do I pass parameters to a module when using insmod?

Section titled “How do I pass parameters to a module when using insmod?”

To pass parameters to a module when loading it with insmod, use the modprobe command instead, like this:

Terminal window
modprobe <module_name> param1=value param2=value
  • Loading a specific kernel module into the kernel
  • Adding new functionality or features to the Linux kernel
  • Updating or replacing an existing kernel module
  • Debugging and testing new kernel modules
  • Overriding default kernel configurations
  • Providing support for new hardware devices