---
title: "Check the OS and kernel version on Linux and Windows · CloudSat"
description: "Find your Linux distribution, kernel and Windows build from the command line with os-release, uname, winver and PowerShell, then update the kernel safely."
url: https://cloudsat.io/learn/check-os-and-kernel-version
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Linux](https://cloudsat.io/learn/topic/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 team November 18, 2026 6 min read

"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:

```bash
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:

```bash
. /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

```bash
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:

```bash
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):

```bash
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

```bash
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](https://cloudsat.io/learn/edit-grub-boot-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](https://cloudsat.io/docs/rebuild-a-server)).

## Windows: version and build

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

```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](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Linux](https://cloudsat.io/learn/topic/linux)

- [Fix apt and systemctl command not found errors on Linux](https://cloudsat.io/learn/fix-apt-and-systemctl-command-not-found): Linux Fix apt and systemctl command not found errors on Linux 6 min read
- [Edit GRUB safely: Grub Customizer or the command line](https://cloudsat.io/learn/edit-grub-boot-settings): Linux Edit GRUB safely: Grub Customizer or the command line 6 min read
- [Find a MAC address on Windows or Linux from the command line](https://cloudsat.io/learn/find-mac-address-windows-linux): Windows Server Find a MAC address on Windows or Linux from the command line 6 min read
- [Install WSL 2 on Windows 11 and 10, then set it up right](https://cloudsat.io/learn/set-up-wsl-2-on-windows): Linux Install WSL 2 on Windows 11 and 10, then set it up right 6 min read
