lsmod command is used to display the information of loaded modules in the Linux kernel. Linux kernel modules are system-level software that can be used directly by operating system kernel.
Kernel modules
The Linux kernel is the core component of Linux operating systems. It manages the system’s resources, and communication between your computer’s hardware and software.
lsmod Command
lsmod is a simple utility and has no options. It formats the contents of the file /proc/modules
, which contains information about the status of all currently-loaded LKMs.
Run lsmod
at the command line to find out what kernel modules are currently loaded:
lsmod
The command outputs information for each loaded kernel module on a new line:
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 ...
There are three columns in each row:
Module
– It displays the name of the module.Size
– The second column shows the size of the module in bytes.Used by
– This column shows a number that indicates how many instances of the module are currently used. Zero value means module is not used.
You can filter the output using grep, to find out a specific module is loaded or not. For example to find whether the kvm
module is loaded you would run:
lsmod | grep kvm
kvm_intel 217088 0
kvm 610304 1 kvm_intel
irqbypass 16384 1 kvm
You can get the more information about a module, issue the modinfo
command.
Conclusion
The lsmod command displays a list of the currently loaded kernel modules.
Feel free to leave a comment if you have any questions.