- modprobe, lsmod, modinfo Command Tutorial With Examples To Load, List Linux Kernel Modules
- List Available Kernel Modules
- List Loaded Modules
- Get Information About Kernel Module
- Load or Install New Kernel Modules
- Remove or Unload Loaded Kernel Module
- List or Check Installed Linux Kernels using command line
- List or Check Installed Linux Kernels
- RedHat / CentOS / RHEL / Fedora Linux user
- To list / display current running kernel version
- Another outputs from my Ubuntu Linux 18.04 LTS desktop
- Find installed kernel version for Debian / Ubuntu / Pop!_OS Linux
- Arch Linux user
- SUSE Enterprise Linux or openSUSE Linux user
- How do I find manually compiled and installed kernels that aren’t in the package manager?
- Alpine Linux user
- How do I list custom compiled kernel?
- Conclusion
- Howto: Display List of Modules or Device Drivers In the Linux Kernel
- Task: List or display loaded modules
- Finding more info about any module or driver
- List Or Check All Installed Linux Kernels From Commandline
- Check All Installed Linux Kernels From Commandline
- 1. Check installed Kernels in Alpine Linux
- 2. List installed Kernels in Arch Linux
- 3. Find installed Linux Kernels in Debian, Ubuntu, Pop!_OS
- 4. View installed Kernels in Fedora, CentOS, RHEL, AlmaLinux
- 5. List all installed Linux Kernels in openSUSE
- Bonus tip — View only current Kernel details
- List all versions of a package
- 4 Answers 4
- EDIT2
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.
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
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.
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.
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.
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
Источник
List or Check Installed Linux Kernels using command line
H ow do I list all installed kernel on Linux operating system? How do I find out current kernel version?
You can use standard package listing command to list installed Linux kernels on your Linux operating systems. This page shows how to list kernel using the command line.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Linux command-line |
Est. reading time | 1m |
List or Check Installed Linux Kernels
The command varies from one Linux distribution to another. In other words, you need to type the command as per your Linux distro.
RedHat / CentOS / RHEL / Fedora Linux user
You need to use standard rpm command or yum command to list installed software. Type the following command at shell prompt:
$ rpm -qa kernel
Sample Outputs:
Here is another outputs from RHEL 8 server:
One can run the yum command/dnf command as follows:
yum list installed kernel
OR
dnf list installed kernel
Listing installed kernels on RHEL 8
To list / display current running kernel version
Type the following uname command:
$ uname -r
$ uname -mrs
Sample outputs:
Another outputs from my Ubuntu Linux 18.04 LTS desktop
Find installed kernel version for Debian / Ubuntu / Pop!_OS Linux
Use the dpkg command along with the grep command to list all installed kernel on your Debian or Ubuntu Linux, enter:
$ dpkg —list | grep linux-image
Sample outputs:
Let us see outputs from my Ubuntu Linux 18.04 LTS desktop:
Arch Linux user
Run the pacman command as follows:
pacman -Q | grep linux
SUSE Enterprise Linux or openSUSE Linux user
Execute the following rpm command:
rpm -qa | grep -i kernel
From my OpenSUSE 15.2 server:
How do I find manually compiled and installed kernels that aren’t in the package manager?
Try to locate them in /lib/modules/ directory using the ls command:
ls -l /lib/modules/
Alpine Linux user
Run the apk command:
# apk info -vvv | grep -E ‘Linux’ | grep -iE ‘lts|virt’
And we will see:
How do I list custom compiled kernel?
Use the following find command:
sudo find /boot/ -iname «vmlinuz*»
Here is what I see:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Please note that vmlinuz is the name of the Linux kernel executable. Typically stored in /boot/ directory. The vmlinuz is a compressed Linux kernel file. It is a bootable file for loading the Linux operating system into memory. On some older Linux distros including latest one, you may find another file called vmlinux. It also the kernel file but in a non-compressed and non-bootable format. To list files in /boot/ run the ls command:
ls -l /boot/
The Linux kernel is compiled by issuing the following command:
sudo make install
The kernel binary on the original UNIX operating system was called unix. When a new Unix kernel containing support for virtual memory was finally written at the University of California at Berkeley, the kernel binary was called vmunix. Hence, the Linux kernel binary is also known as vmlinuz.
Conclusion
You learned how to list installed Kernels version using a bash shell prompt. See how to compile Linux kernel for more information or visit official Linux kernel website here.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
Howto: Display List of Modules or Device Drivers In the Linux Kernel
H ow do I display the list of loaded Linux Kernel modules or device drivers on Linux operating systems?
You need to use lsmod program which show the status of loaded modules in the Linux Kernel. Linux kernel use a term modules for all hardware device drivers.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | lsmod |
Est. reading time | Less than a one minute |
Please note hat lsmod is a trivial program which nicely formats the contents of the /proc/modules , showing what kernel modules are currently loaded.
This is an important task. With lsmod you can verify that device driver is loaded for particular hardware. Any hardware device will only work if device driver is loaded.
Task: List or display loaded modules
Open a terminal or login over the ssh session and type the following command
$ less /proc/modules
Sample outputs:
To see nicely formatted output, type:
$ lsmod
Sample outputs:
First column is Module name and second column is the size of the modules i..e the output format is module name, size, use count, list of referring modules.
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Finding more info about any module or driver
Type the following command:
# modinfo driver-Name-Here
# modinfo thermal_sys
# modinfo e1000e
Sample outputs:
Источник
List Or Check All Installed Linux Kernels From Commandline
Linux Kernel is the core component of a GNU/Linux operating system. It is a free, opensource, monolithic, modular, multitasking, Unix-like operating system kernel. It is created by Linus Torvalds for his i386 PC in 1991. We can install more than one Kernel in our system. Ever wondered how many Linux Kernels you have installed in your Linux box? No? Well, this brief tutorial will teach you how to view or check all installed Linux Kernels along with their versions from commandline in different Linux operating systems.
Check All Installed Linux Kernels From Commandline
Depending upon the Linux distribution you use, there are multiple ways to check all installed Linux kernel details in your system. The easiest and quickest way to check all installed Kernels in a Linux is by using find command.
By default, all installed Linux Kernels and their associated files are stored under /boot directory. Simply check the contents of this directory using find command to view the list of installed Kernels:
Sample output from my Ubuntu 20.04 LTS desktop:
Check all installed Kernels in Linux using find command
As you see in the above output, there are two Linux Kernels versions (5.4.0-64 and 5.4.0-65) are installed in my Ubuntu desktop machine.
Now we will see distribution-specific methods to find out installed Linux kernel details. First, let us start from Alpine Linux.
1. Check installed Kernels in Alpine Linux
We can check all installed Kernels along with their versions using the following apk command:
Sample output:
Check installed Kernels in Alpine Linux
2. List installed Kernels in Arch Linux
To view all installed in Arch Linux and its variants like Manjaro Linux, run the following pacman command:
Sample output:
You can also combine pacman and grep commands to list installed Kernel versions:
Sample output:
List installed Kernels in Arch Linux
As you can see, I have only one Linux Kernel in my Arch Linux system and its version is 5.9.14.
3. Find installed Linux Kernels in Debian, Ubuntu, Pop!_OS
In Debian and other Debian-based systems like Ubuntu, Pop!_OS, Linux Mint, we can find the list of all installed Kernels using dpkg command:
Sample output:
Find installed Linux Kernels in Debian, Ubuntu, Pop!_OS
4. View installed Kernels in Fedora, CentOS, RHEL, AlmaLinux
In RPM-based systems such as Fedora and its downstream versions such as CentOS, RHEL and RHEL-clones such as AlmaLinux, we can view all installed Kernels using rpm command like below:
Sample output from Fedora 33:
View installed Kernels in Fedora
Sample output from AlmaLinux 8.3:
View installed Kernels in AlmaLinux
5. List all installed Linux Kernels in openSUSE
Since openSUSE is also a RPM-based system, the command to list all installed Linux Kernels is same as Fedora, RHEL distributions.
Bonus tip — View only current Kernel details
To view the currently running Kernel, run:
You know now the list of installed Kernels on your Linux system. How would you find when a specific Linux Kernel version is last booted? That’s easy! Refer the following guide to check when a Linux kernel last used or booted on.
Источник
List all versions of a package
Is there a equivalent of this command; yum list kernel-headers —showduplicates on Ubuntu with apt-get, apt-cache etc. The above command lists various versions of the kernel-headers rpm available on F20/RHEL or installations.
Closet I can get using apt-cache showpkg , not sure if there is a better way ?
Expecting similar output:
This would help me simply do a downgrade or upgrade to a specific version.
4 Answers 4
You have the correct command, except linux-image isn’t a real package name.
apt-cache showpkg should work for real packages, though. e.g.
If you want to see all the versions of linux-image -like packages, you can just do a search, e.g.
The problem is that the different versions of the kernel ( linux-image ) are in individual packages, and named independently according to the version. They are not all versions of the one package.
This lists all available packages. To show which is installed, you can use dpkg -l . e.g.
EDIT2
Another way to get information about different but similarly-named packages (e.g. linux-image* ) is by using aptitude search .
You can also filter with grep using this awkward syntax to get around an aptitude bug/feature.
An i in the first column tells you that it’s already installed. See man aptitude for the other characters.
Источник