🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

lsmod Command

Beginner System Information man(8)

List loaded kernel modules

📅 Updated: Mar 16, 2026
SYNTAX
lsmod

What Does lsmod Do?

The lsmod command displays the status of currently loaded Linux kernel modules. Kernel modules are pieces of code that can be loaded into the kernel on demand, extending its functionality without rebooting. They handle hardware drivers, filesystems, network protocols, and various kernel features.

lsmod reads the /proc/modules file and formats the output in a readable table showing the module name, size in memory, usage count, and which other modules depend on it. Understanding loaded modules is essential for hardware troubleshooting, driver management, and kernel debugging.

Common uses include verifying that hardware drivers are loaded (network cards, GPUs, storage controllers), checking if specific kernel features are available (WireGuard, iptables, overlay filesystems), and identifying module dependencies before removal.

Options & Flags

OptionDescriptionExample
(no options) lsmod takes no arguments - lists all loaded modules lsmod
| grep MODULE Filter output for a specific module lsmod | grep wireguard
| head -20 Show first 20 loaded modules lsmod | head -20
| wc -l Count total loaded modules lsmod | wc -l
| sort -k2 -n -r Sort by size (largest first) lsmod | sort -k2 -n -r | head -10

Practical Examples

#1 List all loaded modules

Shows all currently loaded kernel modules with size and dependency information.
$ lsmod
Output: Module Size Used by\nnvidia 2265088 48\nnvidia_modeset 1142784 1\next4 802816 3\nwireguard 90112 0

#2 Check if WireGuard is loaded

Verify the WireGuard kernel module is loaded. Empty output means it is not loaded.
$ lsmod | grep wireguard
Output: wireguard 90112 0

#3 Find network driver modules

Check which network driver module is in use. Helps identify network card driver issues.
$ lsmod | grep -E "e1000|igb|ixgbe|mlx|r8169|virtio_net"

#4 Count loaded modules

Count the total number of loaded kernel modules (excluding header line).
$ echo "Loaded modules: $(lsmod | tail -n +2 | wc -l)"
Output: Loaded modules: 142

#5 Show largest modules

List the 10 largest kernel modules by memory usage.
$ lsmod | sort -k2 -n -r | head -10

#6 Check module dependencies

The "Used by" column shows which other modules depend on this one. A module cannot be removed if its usage count is non-zero.
$ lsmod | grep nvidia

Tips & Best Practices

lsmod reads /proc/modules: lsmod simply formats the output of /proc/modules. You can also read this file directly: cat /proc/modules
Use modinfo for module details: For detailed info about a module: modinfo MODULE_NAME — shows description, author, license, parameters, dependencies, and file path.
Used by column: The "Used by" count shows how many other modules depend on it. A module with "Used by 0" can be safely removed with modprobe -r.

Frequently Asked Questions

How do I check what kernel modules are loaded?
Run lsmod to list all loaded modules. Filter for a specific one: lsmod | grep MODULE_NAME. Use modinfo MODULE_NAME for detailed information.
How do I load a kernel module?
Use sudo modprobe MODULE_NAME to load a module and its dependencies. To load at boot, add the module name to /etc/modules or create a file in /etc/modules-load.d/
How do I remove a kernel module?
Use sudo modprobe -r MODULE_NAME. The module can only be removed if its "Used by" count is 0. Remove dependent modules first.
What is the difference between lsmod and modprobe?
lsmod only lists loaded modules (read-only). modprobe loads and removes modules, handling dependencies automatically. modinfo shows module details.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →