lsmod Command in Linux | Explained

The “lsmod” command is part of the GNU utility packages. Almost all the well-known Linux distributions support the “lsmod” command line utility. The main objective of the “lsmod” command is to figure out all the active loaded kernel modules on the system. The “lsmod” command cannot support arguments or options like other commands. However, it displays the loaded kernel modules in the output.

This post will provide a brief working and usage of the “lsmod” command in Linux.

How to Use lsmod Command in Linux?

The working of the “lsmod” command depends on its syntax. The generalized syntax of the “lsmod” command is written below:

Syntax:

$ lsmod

To get complete information about the “lsmod” command, check its “man” page. This page can be displayed by using the below-mentioned command:

$ man lsmod

Example 1: Displays the Active kernel Modules

The “lsmod” command reads the content of the “/proc/modules” files and displays it in the well-organized format as compared to the “cat /proc/modules” command:

$ lsmod

The output of the “lsmod” command displays three columns discussed below:

  • Module: The first column shows the active kernel module “name”.
  • Size: The second column displays the module sizes in “bytes”.
  • Used by: The third column specifies how often the module is being used. The “zero” tells that the specific module is not used. While the “,(Comma)” after the number indicates any information about what uses that particular module. This information may be the “filesystem identifier” or the “device” name.

Example 2: Displays the Particular Active kernel Modules

To show the specific active kernel module if the entire system runs the “lsmod” command and “grep” command combined with the “|(pipe)” symbol:

$ lsmod |grep drm

The above output displays that the “drm” module is loaded into the system.

That’s all from the lsmod command.

Conclusion

The “lsmod” command shows the Linux kernel status and displays the list of loaded kernel modules. Furthermore, the “lsmod” shows the “/proc/modules” file content in a more generalized format. It displays what kernel modules are currently loaded. This guide has demonstrated the complete information about the “lsmod” command line utility.