REW

How To See Kernel Module?

Published Aug 29, 2025 4 min read
On this page

The following is a comprehensive guide to viewing and managing kernel modules in Linux, covering common commands, their usage, and the file system locations where modules reside.

Viewing currently loaded kernel modules: lsmod

The lsmod command is the most direct way to list all modules currently loaded into the Linux kernel. It reads the contents of the /proc/modules virtual file and formats the output into an easily readable list.

Command:

```lsmod
Use code with caution.

**Output breakdown:**The output is divided into three columns:

- `Module`: The name of the module.
- `Size`: The memory size of the module, in bytes.
- `Used by`: The number of running processes or other modules that are using this module. A value of `0` means it is not in use. The column also lists the names of other modules that depend on it.

**Example output:**

```sh
Module                  Size  Used by
vmw_vsock_vmci_transport    36864  1
vboxsf                  45056  0
snd_intel_dspcfg        28672  2 snd_hda_codec_hdmi,snd_hda_codec_realtek
snd_hda_codec_hdmi      61440  1
snd_hda_codec_realtek   151552  1

Use code with caution.

Getting detailed information on a module: modinfo

To inspect a specific module and view detailed information such as its file path, description, author, license, and parameters, use the modinfo command.

Command:

modinfo [module_name]

Use code with caution.

**Example:**To inspect the e1000 network driver module, run:

modinfo e1000

Use code with caution.

Example output:

filename:       /lib/modules/5.15.0-35-generic/kernel/drivers/net/ethernet/intel/e1000/e1000.ko
license:        GPL v2
description:    Intel(R) PRO/1000 Network Driver
author:         Intel Corporation, <[email protected]>
srcversion:     B4D2D3AB3E4A089C43DAE56
alias:          pci:v00008086d00002E6Esv*sd*bc*sc*i*
# ...and other detailed information

Use code with caution.

Finding all available (installed) kernel modules

While lsmod shows only the modules currently in memory, a much larger pool of modules is available on the file system, ready to be loaded.

**Location of module files:**Module files, which have a .ko (kernel object) extension, are stored in a version-specific subdirectory under /lib/modules/. The directory is named after the kernel version.

**Command to list all available modules:**You can use find combined with uname -r to locate all module files for the currently running kernel.

find /lib/modules/$(uname -r) -type f -name "*.ko*"

Use code with caution.

**Identifying module dependencies:**The dependencies for all modules are pre-calculated and stored in a file called modules.dep. You can view this file for a comprehensive list of dependencies, whether the modules are loaded or not.

Command:

cat /lib/modules/$(uname -r)/modules.dep

Use code with caution.

Tip: If you need to search this file for a specific module's dependencies, you can pipe the output to grep.

cat /lib/modules/$(uname -r)/modules.dep | grep [module_name]

Use code with caution.

Viewing module dependencies with modprobe

For a clearer, recursive view of a specific module's dependencies, the modprobe command with the --show-depends option is a better tool.

Command:

modprobe --show-depends [module_name]

Use code with caution.

Example:

modprobe --show-depends nf_conntrack

Use code with caution.

Example output:

insmod /lib/modules/5.15.0-35-generic/kernel/net/netfilter/nf_conntrack.ko
insmod /lib/modules/5.15.0-35-generic/kernel/lib/bpf/bpf.ko
insmod /lib/modules/5.15.0-35-generic/kernel/net/netfilter/x_tables.ko

Use code with caution.

Inspecting kernel messages with dmesg

For information related to module loading, errors, or other kernel-level events, the dmesg command is used to read the kernel's message ring buffer. This is particularly useful for troubleshooting why a module may have failed to load.

Command:

dmesg | grep [module_name]

Use code with caution.

Example:

dmesg | grep "e1000"

Use code with caution.

Summary of commands and their uses

Command Purpose Output
lsmod Lists all currently loaded kernel modules. Module name, size, and use count/dependencies.
modinfo [module_name] Displays detailed metadata for a specific module, such as author and parameters. Name, path, license, description, dependencies, and parameters.
find /lib/modules/$(uname -r) -name "*.ko*" Locates all installed module files on the file system. A list of all module file paths.
cat /lib/modules/$(uname -r)/modules.dep Shows a full list of all module dependencies for the current kernel. List of modules and their dependencies.
modprobe --show-depends [module_name] Recursively lists all dependencies for a specified module. Commands to load the module and all its prerequisites.
`dmesg grep [module_name]` Filters the kernel message log for events related to a specific module.
Enjoyed this article? Share it with a friend.