modprobe, lsmod, modinfo Command Tutorial With Examples To Load, List Linux Kernel Modules – POFTUT

modprobe, lsmod, modinfo Command Tutorial With Examples To Load, List Linux Kernel Modules


What makes an Operating system Linux Distribution? All Linux distributions use same kernel named Linux Kernel. Linux kernel provides operating system services, hardware management, process management, memory management etc.

Linux kernel is a monolithic kernel which means single executable all in one. But the operating systems should provide dynamic environments to comply user needs. Linux provides mechanism to load some drivers, features etc. This is called kernel modules. In this tutorial we will look kernel modules operations with modprobe command. Most of the examples in this tutorial requires root privileges.

Help

$ modprobe -h
Help
Help

List Available Kernel Modules

Linux kernel came with a lot of default kernel modules. These modules are loaded according to requirements and kernel config provided by the distribution. There is also an option to add new kernel modules externally to the Linux. We can list all of these modules with lsmod command

$ lsmod
List Available Kernel Modules
List Available Kernel Modules

OR another way

$ cat /proc/modules
List Available Kernel Modules
List Available Kernel Modules

List Loaded Modules

As we know kernel modules are loaded or unloaded. We can list only installed kernel modules by using previous command. but in this command we need some external help. We will use egrep to filter installed kernel modules.

$ lsmod | egrep -v  "\s0"
List Loaded Modules
List Loaded Modules

Get Information About Kernel Module

Kernel modules can get different parameter for configuration purposes. Also there are different type of information. Here are some of them which can be listed with modinfo command.

  • filename what is modules file name and the path
  • license modules license type like GPL,GPL2,Apache,TM
  • description short description about the kernel module
  • depends specify what other kernel modules are needed to load this module
  • intree specify if this kernel module is maintained in kernel git repository
  • vermagic specifies the version of the kernel module
  • parm specifies parameter that can be used to configure this kernel module.
$ modinfo qxl
Get Information About Kernel Module
Get Information About Kernel Module

Load or Install New Kernel Modules

Generally Linux operating system automatically loads related kernel modules. There is no need to load them manually in most situations. But some times manual operation may be needed to load kernel modules. We will install module named ipx by using insmod in this example.

$ modprobe ipx

Remove or Unload Loaded Kernel Module

We can remove kernel modules. We will use modprobe command again with -r option by providing the kernel module name. In this example we unload ipx kernel module

$ sudo modprobe -r ipx

LEARN MORE  Nmap Commands Cheat Sheet

Leave a Comment