lsmod Command in Linux: List Kernel Modules

By 

Updated on

4 min read

Terminal output of the lsmod command showing loaded kernel modules

lsmod is a command-line utility that displays information about the currently loaded Linux kernel modules.

This guide explains how to use lsmod to list modules, filter the output, and work with related module management commands.

Kernel Modules

The kernel is the core component of an operating system. It manages the system’s resources and acts as a bridge between your computer’s hardware and software.

The Linux kernel has a modular design. A kernel module, often referred to as a driver, is a piece of code that extends the kernel’s functionality. Modules are either compiled as loadable modules or built into the kernel. Loadable modules can be loaded and unloaded in the running kernel on request, without the need to reboot the system.

Generally, the modules are loaded on demand by udev (device manager). You can also manually load a module into the kernel using the modprobe command, or automatically at boot time using /etc/modules or /etc/modules-load.d/*.conf files.

The kernel modules are stored in the /lib/modules/<kernel_version> directory. To find the version of the running kernel , use the uname -r command.

Using lsmod

lsmod is a simple utility that accepts no options or arguments. It reads the contents of /proc/modules and displays them in a formatted list.

Run lsmod at the command line to see what kernel modules are currently loaded:

Terminal
lsmod

The command outputs information for each loaded kernel module on a new line:

output
Module                  Size  Used by
cmac                   16384  0
rfcomm                 81920  4
...
ahci                   40960  1
intel_lpss_pci         20480  0
i2c_i801               32768  0
libahci                32768  1 ahci
intel_lpss             16384  1 intel_lpss_pci
...

Each line has three columns:

  • Module - The name of the module.
  • Size - The amount of memory the module uses, in bytes.
  • Used by - The number of instances currently using the module, followed by a comma-separated list of dependent modules. A value of zero means the module is not in use.

Filtering Loaded Modules

To check whether a specific module is loaded, pipe the output to grep . For example, to check if the kvm module is loaded:

Terminal
lsmod | grep kvm
output
kvm_intel             278528  0
kvm                   651264  1 kvm_intel
irqbypass              16384  1 kvm

To list all modules that are currently unused (not depended on by any other module):

Terminal
lsmod | awk '$3 == 0'

Getting Module Details with modinfo

To view detailed information about a specific module, such as its description, author, license, and parameters, use the modinfo command:

Terminal
modinfo kvm
output
filename:       /lib/modules/6.8.0-45-generic/kernel/arch/x86/kvm/kvm.ko
license:        GPL
author:         Qumranet
...
description:    Kernel virtual machine module
...

Quick Reference

CommandDescription
lsmodList all loaded kernel modules
lsmod | grep moduleCheck if a specific module is loaded
lsmod | awk '$3 == 0'List unused modules
modinfo moduleShow detailed module information
modprobe moduleLoad a module and its dependencies
modprobe -r moduleUnload a module and its dependencies
insmod /path/to/module.koInsert a module by file path
rmmod moduleRemove a loaded module
cat /proc/modulesRaw output that lsmod reads from

Troubleshooting

modprobe -r or rmmod fails with “module is in use”
Check the Used by column in lsmod and unload dependent modules first. If a device or service is actively using the module, stop that workload before removal.

lsmod: command not found
The kmod package may be missing in minimal containers or stripped-down systems. Install kmod with your package manager and run the command again.

Output looks incomplete in a restricted environment
Some containers or hardened environments expose only a limited /proc/modules view. Run the command on the host system for full module visibility.

Unsafe module unload attempt
Removing active kernel modules can break networking, storage, or other hardware functions. Confirm dependencies and impact before running modprobe -r or rmmod on production systems.

FAQ

Does lsmod accept any options or flags?
No. lsmod takes no options or arguments. It simply reads /proc/modules and formats the output. To filter results, pipe the output to grep or awk.

What is the difference between modprobe and insmod?
modprobe is the recommended tool: it automatically resolves and loads module dependencies. insmod loads a single module by its file path without handling dependencies.

How do I unload a kernel module?
Use modprobe -r module_name or rmmod module_name. The module can only be removed if its “Used by” count is zero, meaning no other modules or processes depend on it.

Can I see modules that were loaded at boot?
Use dmesg | grep module_name to check kernel messages from boot time, or look at the systemd journal with journalctl -k | grep module_name.

Conclusion

The lsmod command lists all currently loaded kernel modules along with their size and dependency information. Combine it with modinfo, modprobe , and grep for a complete module management workflow.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page