Linux 101 : The kernel modules - insmod, rmmod, modprobe -
Kernel modules are a way to load bits of code in the kernel - on as needed basis -.
It saves resources as the system is no overwhelmed by unneeded running processes.
For example, if we don't use a "Wifi" adapter, we could use the below command to unload its module from the kernel:
We could also use the more sophisticated "modprobe" command below.
The "modprobe" command take care of dependencies that a module might have, located usually in the directory "/lib/modules/$(uname -r)":
We don't need to mention the entire path to the module.
The "modprobe" command checks its configuration directory "/etc/modprobe.d" for dependencies.
To list the modules in our system, we use the below command:
To load a module into a system, we could use the below command:
We could also use the below command which takes also care of loading the dependencies the module might have:
To check if our modules were loaded correctly, we could use the below command: