Want to find out which kernel version you are running?

The Linux kernel is much like the central brain of the operating system. Although it is open-source – meaning anyone can view and modify the code – the Linux kernel is built with multiple protocols to ensure stability and security.

This guide will walk you through how to check the Linux kernel version of your operating system.

how to check linux kernel version command line

Prerequisites

  • A system running Linux (Ubuntu, Debian, RHEL, CentOS, or another version)
  • A terminal window / command line (Ctrl-Alt-T, Ctrl-Alt-F2)

4 Commands to Find Linux Kernel Version

uname Command

Launch a terminal window, then enter the following:

uname –r

The system will return a numeric code, for example:

3.10.0-957.21.2.

Each number, separated by a dot or hyphen, is part of a code:

  • 3 – This is the main kernel version
  • .10 – This is the major release version
  • .0 – This is the minor revision level
  • -957 – This is the level of patches and bug fixes

uname command to check kernel version

The uname command includes additional options that you can use to get more information about your kernel. Simply add an option after the command:

  • -a – Display all information
  • o – Display the operating system (usually GNU/Linux)
  • -r – Display kernel release
  • -v – Display kernel version (Usually includes the base OS and time the kernel was compiled)

For a full list of uname commands, enter

uname ––help

uname command for more kernel information


Note: Your kernel version will likely be different than this example.


hostnamectl Command

The hostnamectl command is typically used to display information about the system’s network configuration. It also displays the kernel version.

To check the kernel version, enter the following:

hostnamectl

The second-to-last line should read:

Kernel: Linux 3.10.0-957.21.2.el7.x86_64

hostnamectl

To display the proc/version file, enter the command:

cat /proc/version

The cat command displays the contents of the /proc/version file. This will output the Linux kernel version first, along with additional data about your operating system.

display proc_version file

Display the /proc/version File

dmesg Command

The dmesg command is used to print the message buffer of the kernel. This is usually used to read messages from device drivers, but it can also be used to find the kernel version.

Enter the command:

dmesg | grep Linux

The | (pipe) symbol is usually on the same key as the \ symbol, just above the enter key.

dmesg command

The commands work as follows:

  • dmesg – read the contents of the kernel buffer
  • | – pipe the command into the next command
  • grep – search for a particular string of characters, and display lines that contain them
  • Linux – the exact string of characters that grep should search for (capitalization matters)

The first line of output displays the Linux kernel version.


Note: When updating your kernel, it is recommended that you choose a release version that’s compatible with your version of Linux. Your package manager will typically give you kernel versions that are tested and verified.


Conclusion

This guide showed you several different ways to check the Linux kernel version. Since you’re only reading the output of a file, you shouldn’t need sudo privileges.