/sbin/lsmod

The command /sbin/lsmod in Linux is used to display the currently loaded kernel modules. Here’s a detailed explanation of what lsmod does and how it is used:

Purpose of lsmod

  1. Module Listing:

    • lsmod lists all the kernel modules that are currently loaded into the running kernel.

    • Kernel modules are pieces of code that can be dynamically loaded and unloaded into the kernel to provide additional functionality, such as device drivers or filesystem support.

  2. Dependency Checking:

    • It displays information about each module, including its size, dependencies (other modules it depends on), and usage count.

  3. System Analysis:

    • Administrators use lsmod to troubleshoot system issues related to modules, check module dependencies, and understand which modules are actively in use.

How to Use lsmod

  • Basic Usage: To display a list of loaded kernel modules, run lsmod without any arguments.

    lsmod
  • Example Output:

    Module                  Size  Used by
    nvidia_drm             61440  1
    nvidia_modeset       1220608  2 nvidia_drm
    nvidia              21166080  65 nvidia_modeset
    drm_kms_helper        184320  1 nvidia_drm
    drm                   491520  4 drm_kms_helper,nvidia_drm
    ...
  • Detailed Information: Use the -v or --verbose option for more detailed output, including the module parameters.

    lsmod -v
  • Dependency Tree: Use the -t or --tree option to display the dependency tree of loaded modules.

    lsmod -t

Usage Scenarios

  • Driver Verification: Check if specific hardware drivers (modules) are loaded and functioning correctly.

  • Module Debugging: Identify module dependencies or conflicts that may be causing system instability.

  • System Optimization: Unload unnecessary modules to free up system resources or resolve conflicts.

Conclusion

lsmod is a crucial command-line utility in Linux for managing and inspecting loaded kernel modules. By providing insights into module dependencies and usage, lsmod facilitates efficient system administration, troubleshooting, and performance optimization. Incorporating lsmod into regular system maintenance routines enhances the reliability and functionality of Linux-based environments by ensuring proper module management and troubleshooting capabilities.

Last updated