lsmod is a command-line utility that displays information about loaded Linux kernel modules.
Kernel module
The kernel is the primary component of an operating system. The kernel manages everything in an operating system, including all system resources, and is the bridge between your computer hardware and software.
Linux kernel has a modular design. Kernel modules, or often referred to as drivers, are pieces of code that extend the functionality of the kernel. This module can be compiled as a module that can be loaded into the operating system or part of the kernel itself. These downloadable modules can be unloaded into the running kernel on demand, without rebooting the system.
Generally, units are loaded on demand by udev
(device Manager). You can also load modules manually into the kernel using commands modprobe
, Or automatically when booting with /etc/modules
Or in a file /etc/modules-load.d/*.conf
.
Kernel units are stored in directories /lib/modules/<versi_kernel>
. To find a running kernel version, use the command uname -r
.
Lsmod command
lsmod is a simple utility that does not accept any options or arguments. The thing is reading what’s going on /proc/modules
It displays the contents of the file in a properly formatted list.
Running around lsmod
On the command line to see which kernel modules are currently loaded:
lsmod
The command displays information for each kernel unit loaded 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 ...
Each row contains three columns:
Module
– The first column shows the unit name.Size
– The second column shows the unit size in bytes.Used by
– The third column shows a number indicating the number of instances of the unit currently in use. A zero value means that the unit is not used. A comma-separated list after the number shows what the unit is using.
To see if a specific unit is loaded, filter the output with grep
. For example to see if the module kvm
After downloading, you can run the following command:
lsmod | grep kvm
kvm_intel 278528 0 kvm 651264 1 kvm_intel irqbypass 16384 1 kvm
To get detailed information about the module, use the command modinfo
.
Conclusion
The lsmod command displays a list of currently loaded kernel modules.
.
Originally posted 2020-11-17 11:01:04.