Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Linux

Check the OS and kernel version on Linux and Windows

Find your Linux distribution, kernel and Windows build from the command line with os-release, uname, winver and PowerShell, then update the kernel safely.

CloudSat teamNovember 18, 20266 min read
Abstract illustration of stacked translucent layers marked only with numbers, rising from a server base like geological strata
On this pageLinux: which distribution and release

"What version is this server?" has two answers on Linux. The distribution release (Ubuntu 24.04, Debian 13, AlmaLinux 9) describes the packages and tools around the kernel. The kernel version (6.8, 6.12, 7.0) is a separate number, and a server can run a kernel that differs from the one its distribution shipped with. Windows folds both into one build number. Here is how to read each from a shell, what the numbers mean, and how to move to a newer kernel without locking yourself out.

Linux: which distribution and release

Start with /etc/os-release, the standard file every current distribution provides:

cat /etc/os-release
hostnamectl
lsb_release -a

os-release gives PRETTY_NAME for humans and ID, VERSION_ID and VERSION_CODENAME for scripts. It is a shell-style file, so a script can read it directly:

. /etc/os-release && echo "$ID $VERSION_ID"

hostnamectl prints the operating system, kernel and architecture in one block, and on a virtual machine it adds a Virtualization line such as kvm. lsb_release -a appears in many older guides, but it is often missing: Debian and Ubuntu ship it as a separate lsb-release package, and RHEL 9 dropped it. Some distributions also keep their own file with more detail, such as /etc/debian_version (the Debian point release), /etc/redhat-release or /etc/alpine-release.

Linux: which kernel is running

uname -r
uname -m
cat /proc/version

uname -r prints the running kernel, for example 6.8.0-45-generic on Ubuntu 24.04 or a 5.14.0 build ending in el9 on AlmaLinux 9. The first numbers are the upstream kernel version; the rest is the distribution's own build and flavor. Enterprise distributions backport fixes into an older numbered kernel for years, so a lower number does not mean a less patched system. uname -m gives the architecture (x86_64 or aarch64), and /proc/version adds the compiler used to build the kernel.

Running versus installed kernels

Installing a kernel update does not change the running kernel. It only takes effect at the next boot, which is why uname -r often lags behind the packages:

dpkg --list 'linux-image-*' | grep '^ii'
rpm -q kernel
ls /boot/vmlinuz-*

The first line applies to Debian and Ubuntu, the second to the RHEL family, and the third works anywhere. To ask whether a reboot is pending, Ubuntu creates /var/run/reboot-required after such updates, and on the RHEL family sudo dnf needs-restarting -r answers directly.

Linux: update the kernel

Ubuntu and Debian

Kernel updates arrive with normal upgrades through a metapackage (linux-generic on Ubuntu, linux-image-amd64 on Debian):

sudo apt update && sudo apt full-upgrade
sudo reboot
uname -r
sudo apt autoremove --purge

full-upgrade matters because a new kernel is a new package, which plain upgrade can hold back. autoremove --purge clears kernels that are no longer needed after you have confirmed the new one boots. Two ways to get a newer kernel line without leaving your release:

  • Ubuntu HWE kernels. LTS releases offer newer hardware enablement kernels, for example sudo apt install --install-recommends linux-generic-hwe-24.04.
  • Debian backports. With the backports repository enabled, sudo apt install -t trixie-backports linux-image-amd64 installs a newer kernel on Debian 13.

Livepatch comes with Ubuntu Pro, whose free personal subscription covers up to five machines, and it installs critical kernel fixes with no reboot. Enable it with sudo pro attach and sudo pro enable livepatch. It reduces urgent reboots but does not replace regular ones.

RHEL, AlmaLinux and Rocky Linux

sudo dnf upgrade
sudo grubby --default-kernel
sudo reboot

grubby --default-kernel confirms which kernel boots next. dnf keeps three kernels installed by default (installonly_limit in /etc/dnf/dnf.conf), so an older one is always in the boot menu if the new one misbehaves.

What to avoid

Do not install mainline kernels from personal PPAs or random download sites on a production server. They skip the distribution's patches and testing, and later updates will not manage them. If a new kernel fails to boot, choose the previous one from the GRUB menu and pin it until you know why; editing GRUB settings shows how. When you need a much newer kernel line, moving to a newer distribution release is usually cleaner, and on CloudSat you can rebuild a server onto any of the 39 OS images from the console (rebuild a server).

Windows: version and build

Windows reports one build number for the whole system. These commands work from PowerShell:

winver
cmd /c ver
Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, BuildNumber
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object ProductName, DisplayVersion, CurrentBuild, UBR
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

winver opens the familiar About dialog. The CIM query is the most reliable for scripts: Caption gives the edition name and BuildNumber the build. In the registry query, DisplayVersion shows the release label (such as 24H2) and UBR the update revision, the number after the dot in a full build like 26100.4652 that tells you the patch level. systeminfo labels are translated on non-English systems, so match on them only when you know the language.

Two traps. On Windows 11 the registry's ProductName still says "Windows 10", for compatibility reasons, so use the build number or the CIM Caption instead. And wmic os get, found in many old guides, no longer works: Microsoft removed WMIC from current Windows 11 releases, and CIM cmdlets replace it.

Build Version
14393 Windows Server 2016
17763 Windows Server 2019
19045 Windows 10 22H2
20348 Windows Server 2022
22631 Windows 11 23H2
26100 Windows 11 24H2 and Windows Server 2025
26200 Windows 11 25H2

The Windows kernel follows the same build, so there is no separate kernel version to check. To read the version of a remote server, run the CIM query with -ComputerName, which requires PowerShell remoting to be enabled on the target.

Quick reference

Question Linux Windows (PowerShell)
Which OS and release? cat /etc/os-release Get-CimInstance Win32_OperatingSystem
Which kernel or build? uname -r (Get-CimInstance Win32_OperatingSystem).BuildNumber
Which architecture? uname -m $env:PROCESSOR_ARCHITECTURE
When did it last boot? uptime -s (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
Is it a virtual machine? systemd-detect-virt systeminfo (read the System Model line)

The last boot time is worth checking next to the kernel version: a server that has not restarted in months is almost certainly running an older kernel than the one installed on disk.

FAQ

Why does uname show an older kernel than the one I just installed?

Either the server has not rebooted since the update, or GRUB is set to boot a specific older entry. Reboot first; if uname -r still shows the old version, check the default entry with grubby --default-kernel on the RHEL family or the GRUB_DEFAULT line on Debian and Ubuntu.

Is Windows 10 still supported?

Windows 10 reached end of support on October 14, 2025. Security updates after that date come only through Microsoft's Extended Security Updates (ESU) program, which requires enrollment, so plan to replace any Windows 10 machine that faces the internet.

How do I get the version inside a script?

On Linux, source /etc/os-release and read $ID and $VERSION_ID, plus uname -r for the kernel. On Windows, [System.Environment]::OSVersion.Version returns a version object such as 10.0.26100.0, and (Get-CimInstance Win32_OperatingSystem).BuildNumber returns the build as a string.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.