How to find the Linux Kernel Version?

How to find the Linux Kernel Version?

A newly installed kernel image can show up in `dpkg-query` even though the system is still running its previous kernel. I wanted a clear way to tell the active release from a package waiting on disk.

`uname -r` reports the kernel running now, so its output answers a different question from the package list. The release makes more sense once you know what part of Linux it describes.

What the Linux kernel version tells you

On this system, uname -r returned 6.17.0-1020-oracle, the release of the Linux kernel running now.

The distribution release and kernel release identify different layers. Ubuntu 24.04.5 LTS names the operating system, and the Ubuntu version check finds that distribution value.

ValueWhat it identifiesCommand or source
Kernel releaseThe active Linux kernel releaseuname -r
Kernel build versionBuild information for the active kerneluname -v
Distribution releaseThe Linux distribution and its releasecat /etc/os-release
Installed kernel packagesKernel images available in the package databasedpkg-query on Debian and Ubuntu

What you need before checking

These checks read kernel information, so a regular terminal account is enough. You do not need to install a package or run the commands with sudo.

  • Open a terminal in the Linux system you want to inspect.
  • Run the command on that system, rather than inside a container or remote shell if your question concerns the host kernel.

A container can report the host kernel because containers share the host kernel. For a VM, the command reports the kernel running inside that VM.

How to find the running kernel version

The uname command is the direct answer for the kernel release. I ran it alongside sysctl and got the same release string from both interfaces.

1. Print the kernel release with uname

Use the release option when you need the identifier to report or compare with documentation. The command’s output changes with the running kernel.

uname -r
Linux kernel release shown by uname -r
The release string printed for the running kernel.

The older screenshot is an example, while your output reflects the kernel booted on your system. I use uname -r when I need the short identifier without build details.

Uname Kernel Version
Example uname -r output with a distribution-specific release suffix.

2. Read the kernel build details

Use uname -v for the kernel’s build-version string. It includes build information, so it is longer than the release printed by uname -r.

uname -v

The distinction comes from the options documented by GNU’s uname manual: -r selects the kernel release, while -v selects the kernel version string. For bug reports, include the field the project’s instructions ask for.

3. Read /proc/version

The /proc/version file identifies the running kernel and combines its release with build details. I compared its release text with the uname result, and the identifier matched.

cat /proc/version

The release follows Linux version in the output, and the proc_version manual identifies this file as a string for the kernel currently running.

Kernel version shown in /proc/version
Example /proc/version output with the kernel release highlighted.

4. Query the release with sysctl

The kernel exposes its release through the kernel.osrelease setting, which sysctl can read without changing it.

sysctl -n kernel.osrelease

My output matched uname -r, with -n removing the setting name.

5. Find the kernel line with hostnamectl

On a system with systemd, hostnamectl reports a Kernel line alongside operating-system details. The retained screenshot shows that line beside the distribution name.

hostnamectl
Kernel release in hostnamectl output
The Kernel line in hostnamectl output.

The command comes from systemd, so a minimal system without systemd may not have it. For a command that works across Linux distributions, use uname -r.

The running kernel and installed kernels are different

uname -r reports the kernel active now. A package query reports kernel images installed on disk, which can include a newer release waiting for the next boot or an older release kept for recovery.

dpkg-query -W 'linux-image*'
Installed Linux kernel image packages listed by dpkg
Installed kernel image packages, which do not identify the active kernel by themselves.

The package list answers a different question, so I kept it separate from the running-release check. The Ubuntu installed-package guide covers related package-list commands.

QuestionUse
Which kernel is active?uname -r
Which kernel images are installed?dpkg-query -W ‘linux-image*’ on Debian or Ubuntu
Which Ubuntu release is installed?cat /etc/os-release or the Ubuntu version guide

After installing a kernel package, the active value remains unchanged until the machine boots into that kernel. Use the site’s Linux restart guide only when a restart is appropriate for your system and workload.

When the reported version does not match expectations

Compare the command with the system you meant to inspect. A container may expose the host’s kernel, while a virtual machine reports its guest kernel.

  • If uname -r shows an older release after an installation, check whether the system has booted into the new kernel.
  • If a command reports a distribution name or release, use uname -r for the kernel release instead.
  • If you need the command’s documented options, open the Linux manual-page guide and read the uname manual.

Check the active release before comparing

For a support request or compatibility check, start with the value the system is running, then compare that exact release with the relevant project’s requirements.

uname -r

Linux kernel version questions

These distinctions answer the related searches that can otherwise lead to a package listing or distribution label instead of the active kernel.

Which command displays the Linux kernel version?

Run uname -r to print the release of the Linux kernel currently running.

How do I check the kernel version on Ubuntu?

Open a terminal and run uname -r. The result is the active kernel release, while /etc/os-release identifies the Ubuntu release.

Does dpkg show the running Linux kernel?

No. A dpkg query lists installed kernel image packages. Run uname -r to identify the kernel active now.

What is the difference between uname -r and uname -v?

uname -r prints the kernel release identifier. uname -v prints the kernel build-version string, which includes build details.