lsmod – Display Modules Loaded into the System

The lsmod command is a Linux utility that displays the status of modules in the Linux kernel. It is used to show which kernel modules are currently loaded into the system. A kernel module, also known as a driver, is a piece of code that can be loaded and unloaded from the kernel on demand. The lsmod command can be used to view the status of these modules and check if they are loaded or not.

Overview

The lsmod command is used to display the status of kernel modules in the Linux operating system. The output of the command includes the name of the module, the size of the module, the number of instances of the module that are currently loaded, and the list of other modules that are dependent on the module being displayed. The command does not display any information about the modules that are not currently loaded.

The syntax for using the lsmod command is as follows:

lsmod [options]

To display the list of loaded kernel modules, simply type lsmod in the terminal and press enter. The output will display the name of the module, the number of instances of the module that are currently loaded, and the list of other modules that are dependent on the module being displayed.

$ lsmod
Module                  Size  Used by
nls_utf8               16384  1
isofs                  49152  1
uas                    24576  0
usb_storage            73728  1 uas

Options

The lsmod command provides several options to customize its output. The following table lists all available options:

Option Description
-h or --help Displays the help message and exits.
-V or --version Displays the version information and exits.
-t or --tree Displays the module dependency tree.
-n or --name Displays the module name only.
-s or --size Displays the size of the module in bytes.
-v or --verbose Displays additional information about the module.
-r or --reverse Displays the reverse dependency of the module.

Troubleshooting Tips

One common issue with the lsmod command is that it may not display the correct status of the kernel modules if the system has been recently booted or if the modules have been recently loaded or unloaded. In such cases, it may be necessary to run the command with elevated privileges using sudo or su to ensure that the command can access all necessary information.

Another issue that may arise with the lsmod command is that it may not display the correct information about the dependencies of the kernel modules. This can be caused by missing or outdated information in the module dependency tree. To fix this issue, it may be necessary to update the module dependency tree using the depmod command.

Notes

The lsmod command is a useful tool for system administrators and developers who need to view the status of kernel modules in the Linux operating system. It can be used to troubleshoot issues related to kernel modules and to ensure that all necessary modules are loaded into the system. Additionally, the command can be used to view the dependencies of kernel modules and to check if any modules are missing or outdated.