How to Check the Modules Currently Loaded in the Linux Kernel

Embedded linux



In this article, we show how to check the moddules currently loaded in the linux kernel.

When working with modules, such as when working with device drivers, it is important to know what modules are currently loaded into the kernel and which are not.

This we can do using the lsmod command.





When working with multiple modules, it can be difficult to keep track of what is already loaded into the module with the insmod command, and what modules we have removed with the rmmod command.

You can run this command from any directory.

After running this command on my linux system, I received the following output.


Listing all modules loaded in the linux kernel with the lsmod command


So those are some of the modules currently loaded in the linux kernel.

As a linux programmer, however, you can always insert new modules using the kernel using the insmod command. You can also remove modules from the kernel using the rmmod command.

Below I inserted 2 modules into the linux kernel using the lines below.





After inserting these modules and running lsmod, you can now see these modules are now inserted into the linux kernel.


Running the lsmod command after inserting modules with the insmod command


We then decide to remove these modules from the kernel using the rmmod command shown below.





After removing these modules and running lsmod, you can now see these modules are removed from the linux kernel.


Running the lsmod command after removing modules with the rmmod command


This is especially important if you are working with multiple modules that may share the same names if you are doing a lot of code duplication. That would cause errors, which could be catastrophic.

So this is how to check the modules currently loaded in the linux kernel.



Related Resources





HTML Comment Box is loading comments...