System and processes
The lsmod command
Lists the kernel modules loaded right now and who uses them.
Most useful options
-sSends errors to syslog instead of standard error-vPrints messages about what the program is doing. Normally it prints only when something fails-VShows the version and exits-hShows the help and exitsCopy-ready examples
$ lsmodmodules loaded right now, with their size and the Used by column.$ lsmod | grep -i usbfilters the modules related to USB.$ lsmod | wc -lcounts the lines of the output, header included.$ lsmod | grep '^ext4'checks whether the ext4 module is loaded and how many modules depend on it.You can try them in the browser terminal: it does not touch your computer.
Common errors
| Message | Cause | Fix |
|---|---|---|
| bash: lsmod: command not found | lsmod comes in the kmod package, which is missing from minimal images and containers. | Install it with sudo apt install kmod on Debian or Ubuntu. |
Typical mistakes
- It only shows what is loaded at this moment: an installed module that is not loaded does not appear.
- The Used by column gives a use count and names the modules that depend on this one. A use can also come from a process or an open device, which is not named.
- Modules compiled into the kernel do not appear in the list, even though they work.
Differences from similar commands
FAQ
Can I unload a module that has dependents in Used by?
Not while those modules are loaded. First unload the ones that use it, then the module.
How do I see a module's record?
With modinfo name: file, description and dependencies.
Is it the same as lspci?
No. lsmod lists loaded kernel modules; lspci lists the PCI devices in the machine.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course