lsmod and lsusb

2 UNIX / Linux lsmod Command Examples

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

Syntax:

lsmod

root@t500:~# lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 0a5c:2145 Broadcom Corp. Bluetooth with Enhanced Data Rate II
Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0781:b6d0 SanDisk Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Advertisements

Posted on June 16, 2015, in Linux (Ubuntu/CentOS). Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: