3 ways to check Linux Kernel Version in Command Line

Kernel in any operating system (OS) such as Linux provides various services like memory allocation, resource management, and process execution. It runs in the background and saves the state of processing activities at every step so that data processing can be performed efficiently.

It also executes multiple tasks on behalf of the operating system, such as handling interrupts and enforcing security policies. This will help you troubleshoot and fix the problems related to the system and slow performance.

Therefore, it is essential to check your Linux version to ensure that you’re using the recent and recommended version of the Linux Kernel. This post will demonstrate the 3 possible ways to check the Linux Kernel version.  

How to Check Linux Kernel Version in Command Line?

Here, we’ll go through the three most popular ways to use the command line to determine the Linux kernel version.

Using the uname Command

How to install Kali Linux in Window...

The “uname” command displays to the point information related to the kernel version, and you can apply it by typing.

$ uname -r

As you can see, it provides you with kernel-related information, so if you are confused about what this output means, let me simplify it for you.

5: Kernel Version 15: Major Revision 0: Minor Revision 48: Bug Fix generic is for architecture build specifically

We have used the “r” flag to display kernel-specific information.

You can get more details using the same uname command with its “-a” flag, as mentioned below.

$ uname -a

Here, the “a” flag displays all the kernel-related information.

If you are interested in finding the kernel’s name, you can do that by typing.

$ uname -s

Using the “cat  /proc/version” Command

The “/proc/version” file contains the Linux version, the GCC version, and the Linux Kernel version. The “cat” command can be used on the “/proc/version” file to retrieve its content.

$ cat /proc/version

Using hostnamectl Command

You can also use the hostnamectl command to check the kernel version by typing.

$ hostnamectl

The main purpose of the hostnamectl command is to provide you with the related information of the host or if you are planning to change the hostname.

Additionally, it will provide you with other details, one of which is the kernel version. So, if you are only interested in finding the information related to the Linux kernel version, then you can do that by typing.

$ hostnamectl | grep Kernel

These are the top 3 ways that you can use to check the Linux kernel version.

Bonus Tip: Using the “dmesg” Command to Check the Linux Kernel Version

There is one more way that you can use to check the Linux kernel version. You can do that by using the “dmesg” command, which is specifically used to manage the kernel ring buffer by typing.

$ dmesg | grep Linux

This buffer will be responsible for constantly updating the kernel information with the new one by removing the old information. Linux is the name of the kernel that’s why we have used it here in the command.

These are all the methods to check the Linux kernel version in the command line.

Conclusion

The Linux Kernel version can be checked using the “uname”, “cat /proc/version”, and the “hostnamectl” commands. The kernel in any operating system (OS), such as Linux, runs in the background and provides various services like memory allocation, resource management, and process execution.

We have discussed 3 main ways to check the Linux kernel version in the command line and one additional way to provide you with a detailed guideline.