3 UNIX / Linux insmod Command Examples

What is insmod?
3 insmod examples
Syntax and Options
Related Commands

What is insmod?

insmod command is used to insert modules to Linux kernel.

3 insmod Examples

1. Specify module name as an argument

The following command insert the module airo to the Linux kernel.

# insmod kernel/drivers/net/wireless/airo.ko

Once you’ve inserted the module, use lsmod command to verify that the module has been inserted successfully as shown below.

# lsmod | grep airo
Module                  Size  Used by
airo                   66291  0

Note: It is recommended that you use modprobe command for all your Kernel module manipulation, including inserting a module.

All the modules that are available to be inserted to the kernel are listed in the modules.dep file as shown below.

# more /lib/modules/`uname -r`/modules.dep


# more /lib/modules/2.6.32-100.28.5.el6.x86_64/modules.dep

2. Insert a module with any arguments

If there are any arguments that needs to be passed for the module, give that as 3rd option as shown below.

The following command insert the module dummy to the Linux kernel. In this example, the dummy module takes two arguments type and debug. You can set the values for type and debug arguments and pass it to dummy module as shown below.

# insmod dummy type="wpa" debug=1

3. Specify module name interactively

Let us assume that you want to insert a pcmcia module called ‘axnet_cs’.

First, verify to make sure this module is listed in the modules.dep file

# grep axnet_cs /lib/modules/`uname -r`/modules.dep

Following is the full path of this file.

# ls /lib/modules/`uname -r`/kernel/drivers/net/pcmcia/axnet_cs.ko

Use insmod – and enter the module name interactively.

# insmod -

Or, you can use < to give the module name as shown below.

# insmod - < kernel/drivers/net/pcmcia/axnet_cs.ko

Verify to make sure the module got inserted successfully.

# lsmod | grep axnet
axnet_cs               14627  0

Syntax and Options


insmod [ filename ]  [ module options... ]

Related Commands


Comments on this entry are closed.