Tech Tip: Manage kernel modules

Determining what kernel modules are loaded on your Linux system can be very useful, particularly in a troubleshooting or support environment. For instance, you may know what hardware is in your machine, but you may not know what kernel modules are managing that hardware.

You can also determine some hardware information based on what kernel modules are loaded. So if you're looking at a Linux system you're not familiar with, knowing what kernel modules are loaded can be very beneficial.

You can easily accomplish this with the lsmod command. This command lists all currently loaded kernel modules on the system. It shows the name of the module, its size, usage count, and referring modules (other modules that use it).

If you see a module you're unsure of and want to obtain a little more information, the modinfo command returns information on the module, such as the physical path to the module, the description of the module, its author, and license.

You can remove a loaded module by using the rmmod command, which takes the module name as an argument. Likewise, to load a module manually, you can use the modprobe command with the module name as an option.

For instance, suppose you want to try a different kernel module for your Ethernet card. Remove the old module with the rmmod command, and then load the new module with the modprobe command, as shown below:

# rmmod 8139too
# modprobe new8139

This unloads the 8139too module and loads the new8139 module.