Driver Management

There are several commands available to administer loadable modules on Linux.

Listing currently loaded modules

You can run the lsmod(8) to display the list of currently loaded modules in user memory.

riaan@linux:~> lsmod
Module                  Size  Used by    Not tainted
sr_mod                 14616   0 (autoclean) (unused)
snd-mixer-oss          15576   1 (autoclean)
videodev                6272   0 (autoclean)
isa-pnp                32712   0 (unused)
usbserial              19836   0 (autoclean) (unused)
ne2k-pci                5248   1
8390                    6608   0 [ne2k-pci]
ide-scsi               11056   0
scsi_mod              100788   2 [sr_mod ide-scsi]
ide-cd                 32416   0
cdrom                  29216   0 [sr_mod ide-cd]
nls_iso8859-1           2844   2 (autoclean)
ntfs                   80300   2 (autoclean)
lvm-mod                64996   0 (autoclean)
reiserfs              217908   1

Loading Modules

You can use the insmod(8) or modprobe(8) commands to load a module from the /lib/modules directory structure into user memory for use by the parent.

The advantage of using modprobe over insmod to load modules, is that modprobe will consult a dependency file /lib/modules to determine which other drivers need to be loaded before the requested module.

Unloading modules

To unload a module from user memory you can use the rmmod(8) or modprobe -r commands. The module may not be in use by the kernel or the attempt at removal will fail.

Other module management commands

modinfo(8) displays important information about a module, including its configuration parameters depmod(8) this command analyses all the module binaries under /lib/modules and builds a dependency file in this same directory structure.