The lsmod command can tell you which kernel modules are currently loaded on your system, along with some interesting details about their use.
![Rob Oo \(CC BY 2.0\)][1]
### What are Linux modules?
Kernel modules are chunks of code that are loaded and unloaded into the kernel as needed, thus extending the functionality of the kernel without requiring a reboot. In fact, unless users inquire about modules using commands like **lsmod** , they won't likely know that anything has changed.
One important thing to understand is that there are _lots_ of modules that will be in use on your Linux system at all times and that a lot of details are available if you're tempted to dive into the details.
One of the prime ways that lsmod is used is to examine modules when a system isn't working properly. However, most of the time, modules load as needed and users don't need to be aware of how they are working.
**[ Also see:[Must-know Linux Commands][2] ]**
### Listing modules
The easiest way to list modules is with the **lsmod** command. While this command provides a lot of detail, this is the most user-friendly output.
* "Size" shows the module size (not how much memory it is using)
* "Used by" shows each module's usage count and the referring modules
Clearly, that's a _lot_ of modules. The number of modules loaded will depend on your system and distribution and what's running. We can count them like this:
```
$ lsmod | wc -l
67
```
To see the number of modules available on the system (not just running), try this command:
```
$ modprobe -c | wc -l
41272
```
### Other commands for examining modules
Linux provides several commands for listing, loading and unloading, examining, and checking the status of modules.
* depmod -- generates modules.dep and map files
* insmod -- a simple program to insert a module into the Linux Kernel
* lsmod -- show the status of modules in the Linux Kernel
* modinfo -- show information about a Linux Kernel module
* modprobe -- add and remove modules from the Linux Kernel
* rmmod -- a simple program to remove a module from the Linux Kernel
### Listing modules that are built in
As mentioned above, the **lsmod** command is the most convenient command for listing modules. There are, however, other ways to examine them. The modules.builtin file lists all modules that are built into the kernel and is used by modprobe when trying to load one of these modules. Note that **$(uname -r)** in the commands below provides the name of the kernel release.
```
$ more /lib/modules/$(uname -r)/modules.builtin | head -10
kernel/arch/x86/crypto/crc32c-intel.ko
kernel/arch/x86/events/intel/intel-uncore.ko
kernel/arch/x86/platform/intel/iosf_mbi.ko
kernel/mm/zpool.ko
kernel/mm/zbud.ko
kernel/mm/zsmalloc.ko
kernel/fs/binfmt_script.ko
kernel/fs/mbcache.ko
kernel/fs/configfs/configfs.ko
kernel/fs/crypto/fscrypto.ko
```
You can get some additional detail on a module by using the **modinfo** command, though nothing that qualifies as an easy explanation of what service the module provides. The omitted details from the output below include a lengthy signature.
You can load or unload a module using the **modprobe** command. Using a command like the one below, you can locate the kernel object associated with a particular module:
If you needed to load the module, you could use a command like this one:
```
$ sudo modprobe floppy
```
### Wrap-up
Clearly the loading and unloading of modules is a big deal. It makes Linux systems considerably more flexible and efficient than if they ran with a one-size-fits-all kernel. It also means you can make significant changes — including adding hardware — without rebooting.
**[ Two-Minute Linux Tips:[Learn how to master a host of Linux commands in these 2-minute video tutorials][3] ]**
Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind.