Open In App

How to Check Kernel Version in Linux

Last Updated : 28 Feb, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The kernel is the core component of the Linux operating system, responsible for managing hardware, running processes, and ensuring system stability. Whether you're updating software, installing new drivers, or troubleshooting issues, knowing your kernel version helps ensure everything works smoothly.

In this guide, we'll show you simple and efficient Linux commands to quickly check your kernel version. By using these methods like the uname command, hostnamectl, and dmesg, you'll be able to stay up to date with your kernel version, helping you make informed decisions for system upgrades or troubleshooting.

Checking Kernel Version Using uname Command in Linux

Launch the terminal on your Linux system. You can check the kernel version using the uname command. uname (short for Unix Name) is used to display system information. To get the specific kernel version, use the -r flag with the command.

Execute the following command in the terminal to get the kernel version:

uname -r

Output:

Screenshot-from-2024-12-04-13-04-08
Check Kernel version using uname command

From the above screenshot:

  • 5: This is the Major Version of the kernel.
  • 4: This is the Minor Version of the kernel.
  • 0: This is the Patch Level.
  • 150: This is the Build Number or Patch Level (indicating updates or fixes made to this specific kernel version).
  • generic: This is the Kernel Type (indicating it's a generic version of the kernel, typically used for most hardware).

Checking Kernel Version Using hostnamectl Command in Linux

In this method, we will be checking the Kernel Version using hostnamectl command. hostnamectl command in Linux is used to display the system config information. It also displays the kernel version.

Use the below command in the terminal to get the kernel version.

hostnamectl 

Output:

Screenshot-from-2024-12-04-13-17-21
check kernel version using hostnamectl command

From the above screenshot:

  • Static hostname: GFG0396-UDAY
    The permanent hostname of the system, set during installation or manually.laptop.
  • Boot ID: 99a84a2a5dbc4d8d998befa5a01c301a
    A unique identifier for the current boot session, changing with each reboot.
  • Operating System: Ubuntu 18.04.6 LTS
    Indicates the OS name and version installed on the system.
  • Kernel: Linux 5.4.0-150-generic
    Displays the kernel version, including major version, minor version, patch level, and type.
  • Architecture: x86-64
    Represents the processor architecture, indicating it's a 64-bit system

Checking Kernel Version by viewing /proc/version File in Linux

Rather than using the inbuilt command, we will check the version by viewing the contents of the /proc/version file. This file has various information about the system like compiler details, kernel version, build information, etc. We just need to view the file using the cat command or else we can also use the various text editors like vi, and vim to view the file.

Run the below command in the terminal to check the version.

cat /proc/version

Output:

Screenshot-from-2024-12-04-14-47-14
check kernel version using cat command

From the above screenshot:

  • Linux version: 5.4.0-150-generic
    The Linux kernel version currently in use, including major version, minor version, patch level, and type.
  • (buildd@bos03-amd64-012)
    The username and machine identifier of the build environment where the kernel was compiled.
  • (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04))
    The version of GCC (GNU Compiler Collection) used to compile the kernel, in this case, GCC 7.5.0.
  • #167~18.04.1-Ubuntu SMP
    The kernel build number (#167), Ubuntu version (18.04.1), and SMP (Symmetric Multi-Processing) support, indicating the kernel supports multiple processors.

Check Kernel Version Using dmesg Command in Linux

In this method, we will be using the dmesg command to get the kernel version. dmesg command in Linux is used to display the kernel messages that are created during the booting process of the system. So from these messages, we can check the kernel version.

sudo dmesg | grep Linux

Output:

Screenshot-from-2024-12-04-14-52
check kernel version using dmseg command

From the above screenshot:

  • [ 0.000000] Linux version: 5.4.0-150-generic
    The Linux kernel version in use, including major version, minor version, patch level, and type.
  • (buildd@bos03-amd64-012)
    The username and build environment identifier where the kernel was compiled.

Check Kernel Version Using the dpkg Command in Linux

In this method, we will be using the built-in dpkg command to check the kernel version. Using the -l flag with the command, we can get the information about the list of installed packages and also the kernel version. We need to pipe the output by using the grep command.

dpkg -l | grep linux-image

Output:

Screenshot-from-2024-12-04-14-57-03
check kernel version using dpkg command

From the above screenshot:

  • 5.4.0-150.167~18.04.1: The version of the installed kernel image.
  • amd64: The architecture, indicating a 64-bit system.
  • Signed kernel image generic: Specifies that this is a signed generic kernel image.
  • 5.4.0-84.94~18.04.1: The version of another installed kernel image.
  • amd64: The architecture, again 64-bit.

Check Kernel Version Using the ls Command for Kernel Images in Linux

In this method, we will check the kernel version using the inbuilt ls command. We need to use the ls command in the /boot directory to list the installed kernel images then we can identify the versions easily.

Execute the below command in the terminal to get the kernel version:

ls /boot/vmlinuz-*

Output:

Screenshot-from-2024-12-04-15-00-24
check kernel version using ls command

From the above screenshot:

  • /boot/vmlinuz-5.4.0-150-generic: The kernel image file for version 5.4.0-150-generic.

Also Read:

Conclusion

Knowing the kernel version in Linux is essential for system management, troubleshooting, and ensuring your system remains secure and up-to-date. The kernel is the heart of the Linux operating system, controlling hardware, managing processes, and maintaining system stability. Whether you are updating software, installing new drivers, or resolving issues, understanding your kernel version helps ensure everything functions smoothly.

In this guide, we've covered several easy methods to check the kernel version in Linux. From using simple commands like uname -r, hostnamectl, and dmesg, to exploring files like /proc/version or using package management tools like dpkg, each approach gives you a clear insight into the version of the kernel your system is running. Additionally, commands like ls /boot/vmlinuz-* help identify the kernel images installed on your system.


Next Article

Similar Reads