Modules
LPIC-1LINUX


TL;DR
lsmod | grep <module> -> listing modules
modinfo <module> -> info about a module
sudo modprobe <module> / sudo modprobe -r <module> -> temporary change (disappears at reboot)
/lib/modules/$(uname -r) -> modules warehouse, modules that could be loaded
/proc/modules -> where the lsmod command looks, volatile FS
/sys/module -> echo 1 | sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb, volatile FS, can modify the parameters of a module immediately
------------------------
1 Main commands
Check if it's already there: lsmod | grep <module>
Get info about the module: modinfo <module>
Load the module: sudo modprobe <module>
Verify it created a device: Check /proc/modules first. Then if you want to double check, verify that this created entries in /sys/module/<module>
Remove it cleanly: sudo modprobe -r <module>
2 Commands mainly used by developers
insmode: loads a module using the full path and the file ending in .ko. It does not handle dependencies.
rmmode: it is also a "dummy" command, it removes a module but not its dependencies.
Warning: forcing a rmmode command, is something you could do, but it can cause a "kernel panic". The author is not responsible of the damage to your system with this command or any command listed.
3 Making a change permanent
modprobe is a temporary change (it disappears after reboot). To make it permanent you need to create a .conf file under /etc/modprobe.d/ .
4 Location of modules
There are three different locations where you will find the modules, each one has a different purpose:
/lib/modules/$(uname -r): This is the "warehouse". The files are stored in the hard drive. It shows what modules could be loaded.
/proc/modules: this is a file with a list of all the modules. This is where lsmod looks to get its information. Like everything in /proc, this lives in memory only. This, with the lsmod command, is the place where you look to verify a module is loaded.
/sys/module/: under this directory there are more directories with the modules and its parameters. Parameters can be modified instantly. No need to reload the module. Changes made in /sys are volatile, they are wiped after reboot.
Example: echo 1 | sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb
5 Checking the logs
dmesg | grep -i <module_name>
To know more about different types of modules, take a look at Static vs. Dynamic Modules.
Contact
hello@unixtips.eu
© 2025. All rights reserved.