How to Check Linux Kernel Version from Command Line

Learn how to check Linux kernel version with tested uname, hostnamectl, procfs, journalctl, dmesg, boot image, dpkg, and apt commands, and understand the difference between the running kernel and installed kernel packages.

Published

Updated

Read time 8 min read

Reviewed byDeepak Prasad

How to Check Linux Kernel Version from Command Line

The Linux kernel is the core part of the operating system. It controls hardware access, process scheduling, memory management, filesystems, drivers, and many low-level system features. When you troubleshoot a driver problem, install kernel modules, check security fixes, or compare servers, the first question is often simple: which kernel version is this Linux system running? If you are checking the version before maintenance, also review the guide to properly update the kernel in RHEL/CentOS.

This guide shows tested commands to check the Linux kernel version from the command line. It also explains an important difference that many short guides skip:

  • The running kernel is the kernel currently loaded in memory.
  • The installed kernels are kernel image packages or boot files available on disk.

Most of the time, uname -r is the correct command because it shows the running kernel release. Use package commands such as dpkg, apt, or rpm only when you want to list installed kernel packages. If a kernel update changes boot behavior, the Linux boot process explained article gives useful background.

The examples below were tested on an Ubuntu 25.04 virtual machine running kernel 6.14.0-37-generic. Your hostname, kernel release, build string, package list, and boot files will be different.

NOTE
Quick answer: run uname -r to check the currently running Linux kernel version.

Quick Command Summary

Task Command
Show running kernel release uname -r
Show kernel, release, and architecture uname -srm
Show full kernel string uname -a
Show OS and kernel together hostnamectl
Read kernel release from procfs cat /proc/sys/kernel/osrelease
Read full build string from procfs cat /proc/version
Show kernel version from current boot logs `journalctl -b -k --no-pager
List kernel images in /boot ls -1 /boot/vmlinuz-*
List Ubuntu/Debian kernel packages dpkg --list "linux-image*"
List RHEL-like kernel packages rpm -q kernel

1. Check the Running Kernel Version with uname -r

uname -r is the fastest and most portable way to check the Linux kernel release. It works across major distributions because uname is part of GNU coreutils on typical Linux systems.

bash
uname -r

Tested output:

text
6.14.0-37-generic

This value is the kernel release currently running on the system. In this example:

  • 6.14.0 is the upstream kernel version base.
  • 37 is the Ubuntu package build/revision part.
  • generic is the Ubuntu kernel flavor.

The exact format depends on your Linux distribution. RHEL, CentOS, Rocky Linux, AlmaLinux, Fedora, Debian, Ubuntu, and SUSE all add their own package release or flavor strings.

For a broader command reference, see the Linux commands cheat sheet.


2. Show Kernel Version with System and Architecture

Use uname -srm when you want the kernel name, kernel release, and machine architecture in a short output.

bash
uname -srm

Tested output:

text
Linux 6.14.0-37-generic x86_64

This is useful in scripts, support tickets, and server inventories because it includes the architecture without the long build string printed by uname -a.


3. Show Full Kernel Details with uname -a

Use uname -a when you want the full kernel string, including hostname, kernel build version, build date, architecture, and operating system type.

bash
uname -a

Tested output:

text
Linux server1 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

The important parts are:

  • Linux is the kernel name.
  • server1 is the hostname.
  • 6.14.0-37-generic is the running kernel release.
  • #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 is the kernel build/version string.
  • x86_64 shows the machine architecture.

Do not confuse uname -r and uname -v. uname -r shows the kernel release you normally need. uname -v shows the kernel build/version string.


4. Check Kernel Version with hostnamectl

hostnamectl is mainly used for hostname and machine information, but it also prints the operating system, kernel, architecture, and virtualization type when systemd is available.

bash
hostnamectl

Tested output:

text
Virtualization: oracle
Operating System: Ubuntu 25.04
          Kernel: Linux 6.14.0-37-generic
    Architecture: x86-64

This output is useful when you want both OS version and kernel version in one place. The Kernel: line is the running kernel. The Operating System: line is the Linux distribution release, which is different from the kernel release.

For more on systemd logging and related tools, see how systemd-journald logging works.


5. Check Kernel Release from /proc/sys/kernel/osrelease

Linux exposes the running kernel release through procfs. This file returns the same kernel release as uname -r.

bash
cat /proc/sys/kernel/osrelease

Tested output:

text
6.14.0-37-generic

This method is useful on minimal systems where you want a simple file read instead of running a command that formats system information.


6. Check Full Kernel Build Information from /proc/version

/proc/version contains a longer kernel version string. It includes the kernel release, compiler details, distribution build information, and kernel build date.

bash
cat /proc/version

Tested output:

text
Linux version 6.14.0-37-generic (buildd@lcy02-amd64-049) (x86_64-linux-gnu-gcc-14 (Ubuntu 14.2.0-19ubuntu2) 14.2.0, GNU ld (GNU Binutils for Ubuntu) 2.44) #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025

Use this when you need more than the short release number, for example when comparing compiler/build details across systems.


7. Check Kernel Version from Boot Logs

Boot logs can also show the kernel version loaded during the current boot. This is useful when you are investigating boot behavior or kernel startup messages.

Use journalctl on systemd-based systems:

bash
journalctl -b -k --no-pager | grep -m 1 "Linux version"

Tested output:

text
Jun 07 13:55:30 server1 kernel: Linux version 6.14.0-37-generic (buildd@lcy02-amd64-049) (x86_64-linux-gnu-gcc-14 (Ubuntu 14.2.0-19ubuntu2) 14.2.0, GNU ld (GNU Binutils for Ubuntu) 2.44) #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 (Ubuntu 6.14.0-37.37-generic 6.14.11)

You can also use dmesg:

bash
dmesg | grep -m 1 "Linux version"

Tested output:

text
[    0.000000] Linux version 6.14.0-37-generic (buildd@lcy02-amd64-049) (x86_64-linux-gnu-gcc-14 (Ubuntu 14.2.0-19ubuntu2) 14.2.0, GNU ld (GNU Binutils for Ubuntu) 2.44) #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 (Ubuntu 6.14.0-37.37-generic 6.14.11)

Some systems restrict dmesg for non-root users. If dmesg is blocked, use journalctl -b -k or uname -r instead. For more log filtering examples, see the journalctl command guide.


8. List Kernel Images Available in /boot

The files under /boot show kernel images available on disk. This is not always the same as the running kernel, because older or newer kernels may also be installed.

bash
ls -1 /boot/vmlinuz-*

Tested output:

text
/boot/vmlinuz-6.14.0-33-generic
/boot/vmlinuz-6.14.0-37-generic

In this output, two kernel images are available in /boot, but only one is currently running. Compare this with uname -r before assuming which kernel is active. On RHEL-family systems, you can also set the default boot kernel or change the default kernel version on RHEL/CentOS 8.

For boot troubleshooting, see how to boot into rescue mode on RHEL/CentOS or boot into single-user mode. If the initramfs is related to the problem, see how to update and rebuild initrd.


9. List Installed Kernel Packages on Ubuntu or Debian

On Ubuntu and Debian, kernel image packages usually start with linux-image. Use dpkg to list installed kernel image packages.

bash
dpkg --list "linux-image*" | awk '/^ii/{print $2, $3}'

Tested output:

text
linux-image-6.14.0-33-generic 6.14.0-33.33
linux-image-6.14.0-37-generic 6.14.0-37.37
linux-image-generic-hwe-24.04 6.14.0-37.37

You can also use apt:

bash
apt list --installed "linux-image*"

Tested output:

text
Listing...
linux-image-6.14.0-33-generic/now 6.14.0-33.33 amd64 [installed,local]
linux-image-6.14.0-37-generic/plucky-updates,plucky-security,now 6.14.0-37.37 amd64 [installed,automatic]
linux-image-generic-hwe-24.04/plucky-updates,plucky-security,now 6.14.0-37.37 amd64 [installed,automatic]

Use this section when your question is "which kernel packages are installed?" Use uname -r when your question is "which kernel is running right now?"

For package command details, see the dpkg command examples, apt command examples, and install a specific version with APT if you need a particular kernel package version.


10. Notes for RHEL, CentOS, Rocky Linux, AlmaLinux, and Fedora

RHEL-family systems use RPM packages for the kernel. Use uname -r first when you need the running kernel, then use RPM/DNF or grubby when you need installed kernel packages or bootloader entries.

List installed kernel packages:

bash
rpm -q kernel

List installed kernel-related packages with DNF:

bash
dnf list installed "kernel*"

List bootloader entries known to grubby:

bash
grubby --info=ALL

Show the default kernel selected by the bootloader:

bash
grubby --default-kernel

These commands are especially useful after patching, because the latest installed kernel is not always the kernel currently running. Compare uname -r with rpm -q kernel and grubby --default-kernel when a RHEL-family server still boots into an older kernel.

For RHEL-family systems, see the rpm command examples, dnf command examples, yum command examples, install a specific version with yum, grubby command examples, and boot an older kernel with grubby. After updates, you may also need to remove old kernels on RHEL/CentOS or review kernel-core update best practices.


Frequently Asked Questions

1. What is the fastest command to check Linux kernel version?

uname -r is the fastest and most portable command to show the running Linux kernel release.

2. What is the difference between uname -r and uname -a?

uname -r prints only the kernel release, while uname -a prints the kernel name, hostname, release, build version, architecture, and operating system type.

3. How do I check the Linux kernel version without uname?

Use hostnamectl, cat /proc/sys/kernel/osrelease, cat /proc/version, journalctl -b -k, or dmesg, depending on what is available on the system.

4. Does uname show the installed kernel or the running kernel?

uname shows the currently running kernel. It does not list every kernel package installed on disk.

5. How do I list installed Linux kernels on Ubuntu or Debian?

Use dpkg --list "linux-image*" or apt list --installed "linux-image*" to list installed kernel image packages.

6. How do I list installed Linux kernels on RHEL, CentOS, or Fedora?

Use rpm -q kernel on RHEL-like systems. If grubby is installed, grubby --default-kernel can show the default boot kernel.

Summary

To check the Linux kernel version, use uname -r. It is fast, portable, and shows the currently running kernel release. Use uname -a, hostnamectl, /proc/version, journalctl, or dmesg when you need more context about the kernel build, OS, architecture, or boot messages.

If you need to list installed kernels, use distribution package tools instead. On Ubuntu and Debian, use dpkg or apt with linux-image packages. On RHEL-like systems, use rpm -q kernel and grubby when available.

Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …