List or Check Installed Linux Kernels using command line

last updated in Categories , , , , ,

How 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.

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

List Installed Linux Kernels
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 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:
List Installed Kernels and Currently Running Kernel

Arch Linux user

pacman -Q | grep linux

SUSE Enterprise Linux or openSUSE Linux user

rpm -qa | grep -i kernel

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

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.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at www.nixcraft.com

Historical Comment Archive

10 comment

  1. Hi,

    how to edit the boot order manually in Debian to choose a specific installed kernel to be the default one?

    Thanks.

    1. 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.

  2. 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!

    1. @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!

    Still, have a question? Get help on our forum!