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 | Easy (rss) |
Root privileges | Yes |
Requirements | Linux command-line |
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:
kernel-2.6.18-4.1.15.el5 kernel-2.6.18-8.1.14.el5 kernel-2.6.18-8.1.10.el5
Here is another outputs from RHEL 8 server:
kernel-4.18.0-80.7.2.el8_0.x86_64 kernel-4.18.0-80.4.2.el8_0.x86_64
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:
Linux 2.6.18-8.1.14.el5 x86_64
Another outputs from my Ubuntu Linux 18.04 LTS desktop
uname -r
4.18.0-25-generic
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:
ii linux-image-2.6.20-15-generic 2.6.20-15.27 Linux kernel image for version 2.6.20 on x86/ ii linux-image-2.6.20-16-generic 2.6.20-16.32 Linux kernel image for version 2.6.20 on x86/ ii linux-image-generic 2.6.20.16.28.1 Generic Linux kernel image
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:
kernel-default-5.3.18-lp152.63.1.x86_64 kernel-default-5.3.18-lp152.60.1.x86_64 kernel-firmware-20200107-lp152.2.3.1.noarch purge-kernels-service-0-lp152.4.1.noarch
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/
total 12 drwxr-xr-x 5 root root 4096 Jul 29 17:53 4.15.0-55-generic drwxr-xr-x 5 root root 4096 Jul 29 22:05 4.18.0-25-generic drwxr-xr-x 5 root root 4096 Aug 1 17:19 5.0.0-23-generic
Alpine Linux user
Run the apk command:
# apk info -vvv | grep -E 'Linux' | grep -iE 'lts|virt'
And we will see:
linux-virt-5.4.84-r0 - Linux lts kernel
How do I list custom compiled kernel?
Use the following find command:
sudo find /boot/ -iname "vmlinuz*"
Here is what I see:
[sudo] password for vivek: /boot/vmlinuz-5.4.0-65-generic /boot/vmlinuz-5.4.0-66-generic /boot/vmlinuz-5.4.0-25-generic
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.
- How To Find Out FreeBSD Version and Patch Level Number
- How To Find Which Linux Kernel Version Is Installed On My System
- Find Linux / UNIX Kernel Version Command
- How To Find Out If 32 or 64 bit Unix OS Installed On Server
- Linux: Find If Processor (CPU) is 64 bit / 32 bit [long mode ~ lm]
- List or Check Installed Linux Kernels
- Find Linux Kernel Version Command
- Linux Command: Show Linux Version
🐧 11 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
thanks ! important information.
hi,
it’s working thanks for information
Regards
krishan kumar singh
hey that works for Ubuntu…!
Hi,
how to edit the boot order manually in Debian to choose a specific installed kernel to be the default one?
Thanks.
You need to modify the bootloader configuration. If you haven’t been playing with your installation you’re using GRUB, so search for GRUB configuration tutorials.
yes,
I just want to know the grub.cnfg path to edit it in Debian.
hi, i am new to linux. i want to know what happens to the older kernel when i install a new kernel? does it overwrite? also explain me how do i find the path/location for both older and newer kernels! please help!
@rohit, newer installed kernels do not overwrite existing kernels unless you delete them explicitly. So you can always choose to boot with the proved old one :-)
As for the kernels location, it depends on where do you install them… In my case I always create a /boot partition, so there you could find all those kernels…
Best of luck!
What if you have manually compiled and installed kernels that aren’t in the package manager?
Have you try out?
ls -l /boot/vmlinuz*
Thanks for posting this! Helpful