Does lsmod list modules built into the kernel?

Q When I'm compiling my own kernel I can build modules into the kernel or compile them separately to load when required. If I run lsmod in a terminal, will it list the modules that are built into the kernel, or it will show just the modules that have been loaded separately?

A lsmod lists only the modules that are currently loaded into your kernel. To see a list of all modules available for the current kernel, run modprobe -l. Each of these commands work with loadable modules only, so if you want to know what is compiled into your kernel, you need to inspect the kernel config file with either /boot/config-<version> , /usr/src/linux/.config or, if your kernel has this option enabled, use /proc/config.gz for the running kernel. Look for lines ending in =y, although this also includes options that enables features, not just modules. Use one of these two lines:

grep '=y$' /usr/src/linux/.config
zgrep '=y$' /proc/config.gz

These automate the process of searching for configuration options in the kernel.

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar