Open In App

modinfo command in Linux with Examples

Last Updated : 25 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The modinfo command in Linux is used to display information about a Linux kernel module. It extracts detailed information from the modules available in the system and provides insights into their properties, dependencies, parameters, and more. If the module name is provided without a file name, the command automatically searches the ‘/lib/modules/kernel-version‘ directory for the specified kernel version.

The modinfo command is compatible with all Linux Kernel architectures, making it a versatile tool for system administrators, developers, and users working with kernel modules.

Syntax

modinfo [-0] [-F field] [-k kernel] [modulename|filename...]

Basic modinfo Command Example

The below command displays information about the Bluetooth module, including the module’s author, description, license, dependencies, and more.

modinfo bluetooth

Basic Example

Key Options Used with the modinfo command

1. modinfo –help

It will print the general syntax of the modinfo along with the various options and gives a brief description about each option.

Example:

modinfo --help

2. modinfo -V:

This option gives the version information of modinfo command.

Example:

modinfo -V

3. modinfo -F:

This option only print this field value, one per line. Field names are case-insensitive. Common fields that may include author, description, license, parm, depends, and alias. There are possibly multiple parm, alias and depends on fields. The special field filename lists are the filename of the module.

Example:

modinfo -F modulename

4. modinfo -b:

This option is the root directory for modules.

Example:

modinfo -b modulename

5. modinfo -k:

This option provides the information about a kernel other than the running one. This option is particularly being useful for the distributions that need to extract information from a newly installed set of kernel modules.

For example, to find which firmware files are needed by various modules inside a new kernel for which you need to make an ‘initrd/initramfs’ image prior to booting.

modinfo -k modulename

6. modinfo -0:

This option use the ASCII zero character to separate field values, instead of a new line. This option is proven useful for scripts since a new line can theoretically appear inside a field.

Example:

modinfo bluetooth -0

7. modinfo -a –author, -d –description, -l –license, -p –parameters, -n –filename:

These are the shortcuts used for the –field flag’s author, description, license, parm and filename arguments to make the transition from the old modutils modinfo easy.

Example:

modinfo bluetooth -a

modinfo bluetooth -n

modinfo bluetooth -d

modinfo bluetooth -l

modinfo bluetooth -p

Conclusion

The modinfo command is used for inspecting and managing Linux kernel modules. It allows users to quickly access critical information about kernel modules, such as authorship, dependencies, parameters, and more. Its various options allow for detailed customization of the output, making it suitable for a wide range of use cases, from diagnostics to kernel development.


Next Article

Similar Reads

three90RightbarBannerImg