> For the complete documentation index, see [llms.txt](https://www.shellspells.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.shellspells.net/linux/system-ops/filesystem/kernel-modules-drivers.md).

# Kernel Modules (Drivers)

## <mark style="color:red;">Enumerate</mark>

<table data-header-hidden data-full-width="true"><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:yellow;"><code>uname -a</code></mark></td><td>Prints kernel name, release, and version.</td></tr><tr><td><mark style="color:yellow;"><code>uname -r</code></mark></td><td>Prints just the kernel release.</td></tr><tr><td><mark style="color:yellow;"><code>lsmod</code></mark></td><td>Lists currently loaded kernel modules.</td></tr><tr><td><mark style="color:yellow;"><code>cat /proc/modules</code></mark></td><td>Displays similar output to <mark style="color:yellow;"><code>lsmod</code></mark>, directly from a virtual file in the proc filesystem.</td></tr><tr><td><mark style="color:yellow;"><code>ls /usr/lib/modules</code></mark></td><td>Lists installed kernel module directories.</td></tr><tr><td><mark style="color:yellow;"><code>ls /lib/modules/$(uname -r)</code></mark></td><td>Lists all available kernel modules in the default module directory for the current kernel version.</td></tr><tr><td><mark style="color:yellow;"><code>ls /lib/modules/$(uname -r)/kernel/drivers</code></mark></td><td>Lists available driver modules for the current kernel.</td></tr><tr><td><mark style="color:yellow;"><code>ls /lib/modules/$(uname -r)/extra</code></mark></td><td>Lists extra kernel modules.</td></tr><tr><td><mark style="color:yellow;"><code>modinfo &#x3C;module_name></code></mark></td><td>Retrieves detailed information about a specific kernel module.</td></tr><tr><td><mark style="color:yellow;"><code>systemctl list-units --type=kmod</code></mark></td><td>Lists kernel modules managed as systemd services.</td></tr><tr><td><mark style="color:yellow;"><code>modprobe -n &#x3C;module_name></code></mark></td><td>Simulates loading a module without actually loading it.</td></tr><tr><td><mark style="color:yellow;"><code>modprobe -v &#x3C;module_name></code></mark></td><td>Verbosely loads a kernel module, providing detailed output.</td></tr><tr><td><mark style="color:yellow;"><code>modprobe -l</code></mark></td><td>Lists available modules that can be loaded.</td></tr><tr><td><mark style="color:yellow;"><code>find /lib/modules/$(uname -r)/ -type f -name '*.ko' -exec ls {} ;</code></mark></td><td>Enumerate kernel modules in the directory corresponding to the running kernel version</td></tr></tbody></table>

## <mark style="color:red;">Modify</mark>

<table data-header-hidden data-full-width="true"><thead><tr><th width="310">Command</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:yellow;"><code>depmod -a</code></mark></td><td>Updates module dependency information.</td></tr><tr><td><mark style="color:yellow;"><code>modprobe &#x3C;mod_name></code></mark></td><td>Loads a kernel module if it's not already loaded.</td></tr><tr><td><mark style="color:yellow;"><code>modprobe -r &#x3C;mod_name></code></mark></td><td>Unloads a module.</td></tr><tr><td><mark style="color:yellow;"><code>insmod &#x3C;module_file></code></mark></td><td>Manually loads a module (less common).</td></tr><tr><td><mark style="color:yellow;"><code>insmod &#x3C;module_path></code></mark></td><td>Manually inserts module into the kernel. Use with caution.</td></tr><tr><td><mark style="color:yellow;"><code>rmmod &#x3C;module_name></code></mark></td><td>Removes (unloads) a loaded kernel module.</td></tr><tr><td><mark style="color:yellow;"><code>modconf</code></mark></td><td>Configures kernel modules interactively.</td></tr></tbody></table>

## <mark style="color:red;">File Locations</mark>

<table data-header-hidden data-full-width="true"><thead><tr><th width="437">Directory/File</th><th>Description</th></tr></thead><tbody><tr><td>modprobe.d</td><td>Directory containing configuration files for module options (/etc/modprobe.d/ on many systems).</td></tr><tr><td>/sys/module</td><td>Directory containing information and configuration for loaded kernel modules.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/</td><td>Directory containing kernel modules, where you can add or remove modules.</td></tr><tr><td>/etc/modules</td><td>File where you can list modules to be automatically loaded during system startup.</td></tr><tr><td>/etc/modprobe.d/</td><td>Directory for custom module configuration files.</td></tr><tr><td>/etc/modprobe.conf</td><td>Older file for configuring module options (may not be present on all systems).</td></tr><tr><td>/proc/modules</td><td>File listing currently loaded modules (read-only).</td></tr><tr><td>/proc/sys/kernel/modules_disabled</td><td>File to control module loading (0 for enabled, 1 for disabled).</td></tr><tr><td>/sbin/lsmod</td><td>Location of the lsmod command executable.</td></tr><tr><td>/sbin/modprobe</td><td>Location of the modprobe command executable.</td></tr><tr><td>/sbin/insmod</td><td>Location of the insmod command executable.</td></tr><tr><td>/sbin/rmmod</td><td>Location of the rmmod command executable.</td></tr><tr><td>/sbin/depmod</td><td>Location of the depmod command executable.</td></tr><tr><td>/usr/bin/modinfo</td><td>Location of the modinfo command executable.</td></tr><tr><td>/usr/sbin/modconf</td><td>Location of the modconf command executable.</td></tr><tr><td>/usr/share/modprobe/</td><td>Directory containing module utilities and scripts.</td></tr><tr><td>/usr/share/doc/module-init-tools/</td><td>Location of module initialization tools documentation (may vary by distribution).</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/kernel/</td><td>Directory containing kernel module files.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/modules.dep</td><td>File containing module dependency information.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/modules.alias</td><td>File containing module alias information.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/modules.symbols</td><td>File containing module symbol version information.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/modules.symbols.bin</td><td>Binary version of the module symbols file.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/modules.builtin</td><td>File listing built-in modules.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/modules.order</td><td>File defining module load order.</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/build</td><td>Symbolic link to the kernel source directory (may not be present on all systems).</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/source</td><td>Symbolic link to the kernel source directory (may not be present on all systems).</td></tr><tr><td>/lib/modules/&#x3C;kernel_version>/extra</td><td>Directory where some distributions store additional modules.</td></tr></tbody></table>
