Javascript required
Skip to content Skip to sidebar Skip to footer

How to Check if Python Is Installed on Linux

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 usingfind command to view the list of installed Kernels:

          $ find /boot/vmli*        

Sample output from my Ubuntu 20.04 LTS desktop:

          /boot/vmlinuz /boot/vmlinuz-5.4.0-64-generic /boot/vmlinuz-5.4.0-65-generic /boot/vmlinuz.old        
Check all installed Kernels in Linux using find command
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:

          $ apk info -vv | grep linux        

Sample output:

          libblkid-2.32-r0 - Block device identification library from util-linux            linux-virt-4.14.167-r0 - Linux vanilla kernel            syslinux-6.04_pre1-r1 - Boot loader for the Linux operating system        
Check installed Kernels in Alpine Linux
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:

          $ pacman -Q linux        

Sample output:

          linux 5.9.14.arch1-1        

You can also combine pacman and grep commands to list installed Kernel versions:

          $ pacman -Q | grep linux        

Sample output:

          archlinux-keyring 20201210-1            linux 5.9.14.arch1-1            linux-api-headers 5.8-1 util-linux 2.36.1-4 util-linux-libs 2.36.1-4        
List installed Kernels in Arch Linux
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:

          $ dpkg --list | grep linux-image        

Sample output:

          ii  linux-image-5.4.0-64-generic               5.4.0-64.72                           amd64        Signed kernel image generic  ii  linux-image-5.4.0-65-generic               5.4.0-65.73                           amd64        Signed kernel image generic  ii  linux-image-generic                        5.4.0.65.68                           amd64        Generic Linux kernel image
Find installed Linux Kernels in Debian, Ubuntu, Pop!_OS
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:

          $ rpm -qa kernel        

Or,

          $ rpm -qa | grep -i kernel        

Sample output from Fedora 33:

          kernel-core-5.8.15-301.fc33.x86_64        
View installed Kernels in Fedora
View installed Kernels in Fedora

Sample output from AlmaLinux 8.3:

View installed Kernels in AlmaLinux
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.

          $ rpm -qa | grep -i kernel        

Bonus tip - View only current Kernel details

To view the currently running Kernel, run:

          $ uname -r 5.4.0-65-generic        

Or,

          $ uname -mrs Linux 5.4.0-65-generic x86_64        

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.

  • Find When A Specific Linux Kernel Version Is Last Booted

Hope this helps.

Related read:

  • Display Linux Kernel Module Information With Modinfo Command
  • Find out the Linux distribution name, version and Kernel details
  • How To Find Linux System Details Using inxi
  • Neofetch – Display Linux system Information In Terminal
  • Find Linux System Details Using Python
  • How To Find Hardware And Software Specifications In Ubuntu

How to Check if Python Is Installed on Linux

Source: https://ostechnix.com/list-or-check-all-installed-linux-kernels-from-commandline/