How to Check Kernel Version in Linux
Last Updated :
28 Feb, 2025
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:
Check Kernel version using uname commandFrom 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:
check kernel version using hostnamectl commandFrom 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:
check kernel version using cat commandFrom 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:
check kernel version using dmseg commandFrom 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:
check kernel version using dpkg commandFrom 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:
check kernel version using ls commandFrom 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.
Similar Reads
How to Check Java Version in Linux
Java is a widely used programming language and platform, and having the correct version installed is crucial for running Java applications smoothly. If you're working on a Linux system, knowing your Java version can help ensure compatibility with tools, frameworks, or projects. Whether you're debugg
4 min read
How to Check the MySQL Version in Linux
Checking the MySQL version on a Linux system is a fundamental task for database administrators and developers. Knowing the MySQL version is important for troubleshooting, compatibility, and applying the appropriate updates. In this article, we'll explore various methods to easily determine the MySQL
3 min read
How to Check OpenCV Version in Python
OpenCV (Open Source Computer Vision Library) is a powerful library for computer vision and image processing tasks. Whether you're a beginner or an experienced developer, knowing how to check the version of OpenCV you're using can be essential for compatibility and troubleshooting. In this article, w
3 min read
How to check scala version in terminal?
For Scala developers, it is very important to check the Scala version in the terminal. To make sure that your system is compatible with libraries, frameworks, etc., and to resolve any specific issues that might arise during programming, knowing the Scala version installed on a computer is vital. Wit
3 min read
How to check Scala version in mac?
Scala is a powerful and versatile programming language that combines features of two popular programming paradigms: Object-oriented and Functional. These are the features of the Scala programming language: Multi-paradigmObject-OrientedFunctional ProgrammingJVM and BeyondStatically TypedTo check the
1 min read
How to Check Selenium Python Version
Selenium, a popular automation tool, simplifies web browser automation tasks in Python. However, ensuring you have the correct version installed is crucial for compatibility and accessing the latest features. This article explores various methods to check the Selenium version in Python, empowering u
4 min read
How to check NumPy version installed?
In this article, we are going to learn how we can find out which version of NumPy your Python code uses. The version of any project keeps on changing with time as the project gets updated, new features keep being added, and old bugs are removed. Hence, a lot of work keeps on happening on projects es
2 min read
Check the OS Version in Linux
When we want to install the Software on our system, first we must know whether our current Operating System is supporting this version of the software or not. In Windows, we can easily check it as Windows is based on a GUI-based Operating System.But we prefer to use the Command line instead of the G
4 min read
How to Check NPM Version?
Node Package Manager (npm) is an essential tool for managing JavaScript projects. Whether you're working on a simple script or a large application, knowing your npm version is important for ensuring compatibility and troubleshooting issues. How to Check NPM Version?To check your npm version, you can
3 min read
How to Check PyYAML Version
Python Programming Language has various libraries and packages for making tasks easier and more efficient. One such library is PyYAML, which is widely used for parsing and writing YAML, a human-readable data serialization standard. In this article, we will see different methods to check the PyYAML v
3 min read