Kernel modules

A kernel module is an object file that contains code to extend the running kernel of an operating systems. It is a standalone-file, typically used to add support for new hardware.

Kernel modules are usually stored in the /lib/modules subdirectories. The name of each subdirectory is based on the release number of the kernel:

linux lib modules directory

As you can see from the output above, the system has all kernel modules stored inside the /lib/modules/3.0.76-0.11-default directory.

You can see which modules are currently loaded into the running kernel on your computer by using the lsmod command:

linux lsmod command

As you can see, the first column (Module) specifies the names of all the modules that are currently loaded. The Used by column describes what is using the module. All entries have a number which indicates the number of other modules or processes that are using the module. For example, in the preceding example, the md5 module isn’t currently in use, as shown by its value of 0; but the nls_utf8 module is being used, as shown by its value of 1.

You can use the modinfo command to show information about a kernel module. The syntax of the command is:

modinfo MODULE_NAME | FILENAME

For example, to show information about the md5 module, we can use the following command:

linux modinfo command

Geek University 2022