≡ Menu

Find Out Linux Kernel Modules ( Drivers ) Location / Directory

Can you tell me an exact location of Linux kernel driver under Linux file system? Where to find all available modules under Linux operating systems?

The /lib/modules/kernel-version/ directory stores all compiled drivers under Linux operating system. You can use the modprobe command to intelligently add or remove a module from the Linux kernel. The modprobe command looks in the module directory /lib/modules/$(uname -r) for all the modules and other files, except for the optional /etc/modprobe.conf configuration file and /etc/modprobe.d directory. Type the following command to display current modules directory name:
$ echo "Modules dir: /lib/modules/$(uname -r) for kernel version $(uname -r)"
Sample outputs:

Modules dir: /lib/modules/2.6.18-238.el5 for kernel version 2.6.18-238.el5

To see the contains of the directory, enter:
$ ls -l /lib/modules/$(uname -r)
Sample output:

total 1396
lrwxrwxrwx 1 root root     46 Jan 14 04:57 build -> ../../../usr/src/kernels/2.6.18-238.el5-x86_64
drwxr-xr-x 2 root root   4096 Dec 19 13:37 extra
drwxr-xr-x 9 root root   4096 Jan 14 04:57 kernel
-rw-r--r-- 1 root root 297080 Jan 14 04:57 modules.alias
-rw-r--r-- 1 root root     69 Jan 14 04:57 modules.ccwmap
-rw-r--r-- 1 root root 218901 Jan 14 04:57 modules.dep
-rw-r--r-- 1 root root    147 Jan 14 04:57 modules.ieee1394map
-rw-r--r-- 1 root root    375 Jan 14 04:57 modules.inputmap
-rw-r--r-- 1 root root   2699 Jan 14 04:57 modules.isapnpmap
-rw-r--r-- 1 root root     74 Jan 14 04:57 modules.ofmap
-rw-r--r-- 1 root root 232149 Jan 14 04:57 modules.pcimap
-rw-r--r-- 1 root root   4033 Jan 14 04:57 modules.seriomap
-rw-r--r-- 1 root root 147317 Jan 14 04:57 modules.symbols
-rw-r--r-- 1 root root 396941 Jan 14 04:57 modules.usbmap
lrwxrwxrwx 1 root root      5 Jan 14 04:57 source -> build
drwxr-xr-x 2 root root   4096 Dec 19 13:37 updates
drwxr-xr-x 3 root root   4096 Jan 14 04:57 weak-updates

You can change directory by typing the following command:
$ cd /lib/modules/$(uname -r)
$ pwd

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 1 comment… add one }

  • Akshay March 21, 2014, 5:11 am

    Where are the .c files for the driver placed in the kernel tree?
    I need to edit the “class driver” of a flash drive so that whenever it is attached to the system, a specific message should be printed on the console.

Leave a Comment