Updated: 2 November 2026 · Applies to: Debian 13, Ubuntu 24.04 and 26.04, AlmaLinux 10, Rocky Linux 9 and 10, Fedora 44
To see which Linux distribution and version you are running, print /etc/os-release. It exists on every current distribution, needs no extra package and works the same over SSH on any server:
cat /etc/os-release
For the kernel version, use uname -r. The rest of this article shows the other ways to check, what each one tells you, and the traps (containers, Ubuntu's /etc/debian_version, a missing lsb_release).
1. Check the distribution with /etc/os-release
Output on Ubuntu 26.04 (shortened):
PRETTY_NAME="Ubuntu 26.04.1 LTS" NAME="Ubuntu" VERSION_ID="26.04" VERSION="26.04.1 LTS (Resolute Raccoon)" VERSION_CODENAME=resolute ID=ubuntu ID_LIKE=debian
Output on AlmaLinux 10 (shortened):
NAME="AlmaLinux" VERSION="10.2 (Lavender Lion)" ID="almalinux" ID_LIKE="rhel centos fedora" VERSION_ID="10.2" PRETTY_NAME="AlmaLinux 10.2 (Lavender Lion)" SUPPORT_END=2035-06-01
The useful lines are:
- PRETTY_NAME: the full name and version, for example "Debian GNU/Linux 13 (trixie)" or "Rocky Linux 9.8 (Blue Onyx)".
- ID and VERSION_ID: short machine-readable values (
debian13,ubuntu24.04,almalinux10.2,rocky10.2,fedora44). - ID_LIKE: the family the distribution belongs to. AlmaLinux and Rocky Linux say
rhel centos fedora, Ubuntu saysdebian. This tells you whether instructions for RHEL or Debian apply. - SUPPORT_END (AlmaLinux, Rocky Linux, Fedora): the date security updates stop for that release.
To print only the name and version:
grep PRETTY_NAME /etc/os-release
Output on Debian 13:
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
In a shell script, load the file and use its variables directly:
. /etc/os-release && echo "$ID $VERSION_ID"
Output on Rocky Linux 10:
rocky 10.2
2. Check with hostnamectl (systemd)
On a normal server or VPS that runs systemd, hostnamectl shows the operating system, kernel and architecture together, plus whether the machine is virtual:
hostnamectl
Output on AlmaLinux 10 (shortened: machine and boot IDs removed, host name replaced with vps):
Static hostname: vps
Icon name: computer-container
Chassis: container
Virtualization: podman
Operating System: AlmaLinux 10.2 (Lavender Lion)
CPE OS Name: cpe:/o:almalinux:almalinux:10.2
OS Support End: Fri 2035-06-01
OS Support Remaining: 8y 6month 3w 6d
Kernel: Linux 5.14.0-503.16.1.el9_5.x86_64
Architecture: x86-64
We ran this in a test container with systemd, which is why it says container and podman. On a KVM VPS the Chassis line says vm and Virtualization says kvm, and Kernel shows your own kernel. OS Support End appears when the distribution publishes an end date (AlmaLinux, Rocky Linux and Fedora do). If you see "System has not been booted with systemd as init system (PID 1). Can't operate.", you are inside a container without systemd: use /etc/os-release instead.
3. Check with lsb_release
lsb_release -a prints the distributor, description, release number and codename:
lsb_release -a
Output on Ubuntu 24.04:
Distributor ID: Ubuntu Description: Ubuntu 24.04.5 LTS Release: 24.04 Codename: noble
lsb_release is not always installed:
- Ubuntu 24.04 and 26.04: installed on normal server installs (the
lsb-releasepackage is part of Ubuntu's minimal system), but missing from minimal container images. - Debian 13: not installed by default (install command below).
- Fedora 44: not in the container image; the package is called
lsb_release(install command below). - AlmaLinux 10 and Rocky Linux 9: in our tests no package in the standard repositories provides
lsb_release. Use/etc/os-releaseorhostnamectlinstead.
On Debian (as root):
apt install lsb-release
On Fedora (as root):
dnf install lsb_release
For a single line with only the description:
lsb_release -ds
Output on Debian 13:
Debian GNU/Linux 13 (trixie)
4. Check the distribution-specific release files
Older guides tell you to read one file per distribution. These are the ones that still exist on current releases:
- AlmaLinux, Rocky Linux, Fedora:
/etc/redhat-releaseand/etc/system-release, plus/etc/almalinux-release,/etc/rocky-releaseor/etc/fedora-release. Each holds one line, for example "AlmaLinux release 10.2 (Lavender Lion)" or "Fedora release 44 (Forty Four)". - Debian:
/etc/debian_versionholds the point release, for example13.7. - Ubuntu:
/etc/lsb-releaseholdsDISTRIB_RELEASE=24.04andDISTRIB_DESCRIPTION="Ubuntu 24.04.5 LTS".
cat /etc/redhat-release
Output on Rocky Linux 9:
Rocky Linux release 9.8 (Blue Onyx)
Two traps:
- On Ubuntu,
/etc/debian_versiondoes not show the Ubuntu version. It shows the Debian base Ubuntu was built from:trixie/sidon Ubuntu 24.04 andforky/sidon Ubuntu 26.04. Use/etc/os-releaseinstead. /etc/centos-releaseonly exists on CentOS, and the old/etc/SuSE-releasefile is gone: openSUSE Leap 15.6 has only/etc/os-release. When a file is missing, fall back to/etc/os-release, which is the one file every current distribution provides.
5. Check the kernel version
The distribution version and the kernel version are different things. To print the running kernel release:
uname -r
Output on our AlmaLinux 9 test server (a lab example):
5.14.0-503.16.1.el9_5.x86_64
To print everything uname knows (kernel name, host name, kernel release and build, architecture):
uname -a
Output on the same server (host name replaced with vps):
Linux vps 5.14.0-503.16.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Dec 13 01:47:05 EST 2024 x86_64 x86_64 x86_64 GNU/Linux
For the architecture only (x86_64, or aarch64 on ARM), use uname -m. /proc/version also shows who built the kernel and with which compiler:
cat /proc/version
Output on the same server:
Linux version 5.14.0-503.16.1.el9_5.x86_64 (mockbuild@x64-builder02.almalinux.org) (gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2), GNU ld version 2.35.2-54.el9) #1 SMP PREEMPT_DYNAMIC Fri Dec 13 01:47:05 EST 2024
For installed (not just running) kernels and how to tell whether a reboot is needed after an update, see How to Check the Kernel Version in Linux: Running Kernel, Installed Kernels and Reboot Check.
Containers and container-based VPS: why the answers can disagree
Inside a Docker or Podman container, /etc/os-release describes the container image, but uname and /proc/version show the kernel of the host machine, because containers share the host kernel. In our tests a Debian 13 container on an AlmaLinux 9 host reported "Debian GNU/Linux 13 (trixie)" in /etc/os-release and the AlmaLinux kernel 5.14.0-503.16.1.el9_5.x86_64 from uname -r. Container images also usually lack systemd, so hostnamectl is missing or fails there, and a Fedora container image reports VERSION="44 (Container Image)".
The same applies to container-based VPS platforms such as OpenVZ or LXC. A KVM VPS runs its own kernel, so uname -r shows the kernel your distribution installed, and hostnamectl works as on a physical server.
Quick reference
- Distribution and version:
cat /etc/os-release - Distribution, kernel and virtualisation in one view:
hostnamectl - Release and codename (Debian family):
lsb_release -a - Kernel release:
uname -r; everything:uname -a; architecture:uname -m
Need a server to try this on? A Ucartz KVM VPS runs its own kernel, so every command above shows the real values for your system.