Kernel Modules (Drivers)

Enumerate

uname -a

Prints kernel name, release, and version.

uname -r

Prints just the kernel release.

lsmod

Lists currently loaded kernel modules.

cat /proc/modules

Displays similar output to lsmod, directly from a virtual file in the proc filesystem.

ls /usr/lib/modules

Lists installed kernel module directories.

ls /lib/modules/$(uname -r)

Lists all available kernel modules in the default module directory for the current kernel version.

ls /lib/modules/$(uname -r)/kernel/drivers

Lists available driver modules for the current kernel.

ls /lib/modules/$(uname -r)/extra

Lists extra kernel modules.

modinfo <module_name>

Retrieves detailed information about a specific kernel module.

systemctl list-units --type=kmod

Lists kernel modules managed as systemd services.

modprobe -n <module_name>

Simulates loading a module without actually loading it.

modprobe -v <module_name>

Verbosely loads a kernel module, providing detailed output.

modprobe -l

Lists available modules that can be loaded.

find /lib/modules/$(uname -r)/ -type f -name '*.ko' -exec ls {} ;

Enumerate kernel modules in the directory corresponding to the running kernel version

Modify

depmod -a

Updates module dependency information.

modprobe <mod_name>

Loads a kernel module if it's not already loaded.

modprobe -r <mod_name>

Unloads a module.

insmod <module_file>

Manually loads a module (less common).

insmod <module_path>

Manually inserts module into the kernel. Use with caution.

rmmod <module_name>

Removes (unloads) a loaded kernel module.

modconf

Configures kernel modules interactively.

File Locations

modprobe.d

Directory containing configuration files for module options (/etc/modprobe.d/ on many systems).

/sys/module

Directory containing information and configuration for loaded kernel modules.

/lib/modules/<kernel_version>/

Directory containing kernel modules, where you can add or remove modules.

/etc/modules

File where you can list modules to be automatically loaded during system startup.

/etc/modprobe.d/

Directory for custom module configuration files.

/etc/modprobe.conf

Older file for configuring module options (may not be present on all systems).

/proc/modules

File listing currently loaded modules (read-only).

/proc/sys/kernel/modules_disabled

File to control module loading (0 for enabled, 1 for disabled).

/sbin/lsmod

Location of the lsmod command executable.

/sbin/modprobe

Location of the modprobe command executable.

/sbin/insmod

Location of the insmod command executable.

/sbin/rmmod

Location of the rmmod command executable.

/sbin/depmod

Location of the depmod command executable.

/usr/bin/modinfo

Location of the modinfo command executable.

/usr/sbin/modconf

Location of the modconf command executable.

/usr/share/modprobe/

Directory containing module utilities and scripts.

/usr/share/doc/module-init-tools/

Location of module initialization tools documentation (may vary by distribution).

/lib/modules/<kernel_version>/kernel/

Directory containing kernel module files.

/lib/modules/<kernel_version>/modules.dep

File containing module dependency information.

/lib/modules/<kernel_version>/modules.alias

File containing module alias information.

/lib/modules/<kernel_version>/modules.symbols

File containing module symbol version information.

/lib/modules/<kernel_version>/modules.symbols.bin

Binary version of the module symbols file.

/lib/modules/<kernel_version>/modules.builtin

File listing built-in modules.

/lib/modules/<kernel_version>/modules.order

File defining module load order.

/lib/modules/<kernel_version>/build

Symbolic link to the kernel source directory (may not be present on all systems).

/lib/modules/<kernel_version>/source

Symbolic link to the kernel source directory (may not be present on all systems).

/lib/modules/<kernel_version>/extra

Directory where some distributions store additional modules.

Last updated

Was this helpful?