top of page

Posts

Kernel Modules, proc Directory, and lsmod

Updated: Apr 29, 2022




Q: Which command displays information about loaded kernel modules? (Select all)

  1. lsmod

  2. modprobe

  3. cat /proc/modules

  4. cat /proc/modprobe

  5. cat /proc/mod

↑Select the above rows to see the answer


If you answered the above question correctly, maybe this blog post is too basic for you but it is always good to have a recap, isn't it?


So today's topics are kernel modules and proc directory, in addition to a command lsmod.




 

What are kernel modules?


Kernel modules are independent components of a kernel that contains various functions to be handled by the kernel.


By separating those functions from the kernel as modules, the size of the kernel itself can be reduced, and only the necessary functions can be loaded, or unnecessary functions can be unloaded.


Major commands to control kernel modules

Command

Use

modprobe

Load and unload kernel modules with considering their dependencies.

​insmod

Load kernel modules.

rmmod

Unload kernel modules.

modinfo

Display the details of each module.



 

What is /proc directory?


A virtual file system for handling information such as processes, hardware, and system resources. The file does not exist on the hard disk but is created in memory when the system is booted.



Major files under proc directory

File Name

Description

interrupts

Information about IRQ

ioports

Information about I/O addresses

bus/pci/devices

Information about PCI devices

bus/sub/devices

Information about USB devices

meminfo

Information about memory

cpuinfo

Information about CPU

dma

Information about DMA channels that are currently being used

modules

Information about modules that are currently loaded

scsi/scsi

Information about SCSI devices


So you can refer to information about kernel modules by checking the modules file.


And the lsmod command can directly display the information.



 


Since now you know what is kernel modules and where to refer to for checking what modules are loaded, let's simply use lsmod instead of using a cat command with writing a full pass of the file for example.


bottom of page