Skip to content

lsmod Command Cheat Sheet

The lsmod command shows the status of modules in the Linux Kernel. It is a simple way to format the contents of /proc/modules.


Synopsis

lsmod

Usages

List All Modules

lsmod

Output Columns: 1. Module: Name of the kernel module. 2. Size: Size of the module in RAM (bytes). 3. Used by: usage count and list of referring modules.

Example Output

Module                  Size  Used by
iptable_filter         12816  1
ip_tables              27126  1 iptable_filter
x_tables               44633  5 ip_tables,iptable_filter,...
nfsd                  362321  13
Interpretation: ip_tables is used by iptable_filter. It cannot be unloaded while iptable_filter is loaded.


Filtering

Check if a Specific Module is Loaded

lsmod | grep kvm

Count Loaded Modules

lsmod | wc -l

lsmod just lists them. To actually manage them, use:

modinfo

Get detailed info (description, author, parameters) about a module.

modinfo e1000e

modprobe

Load or Unload modules safeley (handling dependencies).

sudo modprobe bluetooth   # Load
sudo modprobe -r bluetooth # Unload

insmod / rmmod

Lower-level tools (mostly for developers). modprobe is preferred.


Notes

  • If Used by is 0, the module creates no dependencies and is likely safe to remove, though it might be handling hardware.
  • If Used by is negative (-1), the module is being inserted or removed, or is built-in.