how to find Linux module path

You can use "locate" or "find" command on these modules to find where they are , for example

[root@localhost core_src]# lsmod
Module                  Size  Used by
iptable_filter          2793  0
ipt_MASQUERADE          2466  1
iptable_nat             6158  1
vmware_balloon          7199  0
i2c_piix4              12608  0
i2c_core               31276  1 i2c_piix4
shpchp                 33482  0
ext4                  371331  2
mbcache                 8144  1 ext4
jbd2                   93312  1 ext4
sd_mod                 39488  4
crc_t10dif              1541  1 sd_mod
sr_mod                 16228  0
cdrom                  39803  1 sr_mod
mptspi                 17051  3
mptscsih               36828  1 mptspi
mptbase                94005  2 mptspi,mptscsih
scsi_transport_spi     26151  1 mptspi
pata_acpi               3701  0
ata_generic             3837  0
ata_piix               22846  0
dm_mirror              14101  0
dm_region_hash         12170  1 dm_mirror
dm_log                 10122  2 dm_mirror,dm_region_hash
dm_mod                 81692  2 dm_mirror,dm_log
[root@localhost core_src]# locate vmware_balloon
/lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/misc/vmware_balloon.ko

Sorry if the answer comes a bit late but I just stumbled across this particular question myself today...

To minimize manual labor here is my listing of the paths curretly loaded modules are loaded from:

awk '{ print $1 }' /proc/modules | xargs modinfo -n | sort

I needed this to create a minimal kernel image containg only the modules i really need. Unfortunately lsmod only displays the name field which does not alwys match the modules# file name (e.g phy-am335x-control.ko and phy_am335x_control). I hope this helps.


Get the paths from the list of loaded modules. Without the need for awk.

while IFS= read -r line;
    do modinfo -n "${line%% *}"
done < /proc/modules | sort