2 UNIX / Linux lsmod Command Examples

What is lsmod?
2 lsmod examples
Syntax and Options
Related Commands

What is lsmod?

lsmod is used to view the modules that are currently loaded in the Linux kernel.

2 lsmod Examples

1. View all modules

To view all the modules that are currently loaded in the kernel use lsmod as shown below.

# lsmod
Module                  Size  Used by
michael_mic             1744  12
arc4                    1165  6
snd_hda_codec_idt      54919  1
drm_kms_helper         30200  1 i915
snd_hda_intel          22235  4
snd_hwdep               5040  1 snd_hda_codec
snd_pcm                71475  2 snd_hda_intel,snd_hda_codec

The output of the lsmod command contains the following three columns:
Module: Module Name
Size: Size of the Module
Used by: The dependent module that is using it.

2. View a specific module (along with it depedent modules)

Pipe the lsmod command output to grep to view whether a specific module is loaded in the kernel (along with all the dependent modules)

For example, the following example displays information abouge drm module, and it also displays the other two modules that are dependent on drm.

# lsmod | grep drm
drm_kms_helper         30200  1 i915
drm                   168060  6 i915,drm_kms_helper
agpgart                32011  2 drm,intel_agp

Syntax and Options



Related Commands


Comments on this entry are closed.

  • Ciro Duran Santilli June 10, 2013, 12:49 am

    My module failed to load and generated an oops. Now I get a negative number in the used by field and I can’t remove the module, nor reinsert it, without rebooting. What does that mean? How to correct this without rebooting?