How to Check Linux Version: Distro and Kernel Commands

If you need to know which Linux distribution is installed, the fastest method is usually to read /etc/os-release. That file is present on most modern Linux systems and shows the distribution name and version in a simple format.
This guide shows several command-line ways to check your Linux distribution version and explains when to use each method.
Quick Reference
| Method | Command | Best For |
|---|---|---|
| Recommended | cat /etc/os-release | Most modern Linux distributions |
| Short summary | hostnamectl | systemd-based systems |
| LSB output | lsb_release -a | Systems with lsb-release installed |
| Older systems | cat /etc/*release | Older distributions without os-release |
| Kernel only | uname -r | Linux kernel version, not distro version |
Check Linux Version with /etc/os-release
The /etc/os-release file contains operating system identification data such as the distribution name, version, and ID. On most current Linux distributions, this is the best starting point.
cat /etc/os-releasePRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.7
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"The VERSION_ID line holds the major release number, and VERSION_CODENAME shows the release name. On Debian 13, the DEBIAN_VERSION_FULL line also includes the point release, 13.7 in this example. Other distributions do not use this field, so do not rely on it in scripts that run on more than Debian.
On rolling-release distributions such as Arch Linux, this file may show the distribution name and ID without a numbered distro release. In that case, use the package manager or distribution release notes for the current release state.
If you only want the human-readable version string, look for the PRETTY_NAME line:
grep PRETTY_NAME /etc/os-releasePRETTY_NAME="Debian GNU/Linux 13 (trixie)"Check Linux Version with lsb_release
The lsb_release utility prints Linux Standard Base information about the distribution. It is useful when the package is installed, but it is not available on every minimal system.
lsb_release -aDistributor ID: Debian
Description: Debian GNU/Linux 13 (trixie)
Release: 13
Codename: trixieThe distribution name and version appear on the Description line. To show only that line, run:
lsb_release -dDescription: Debian GNU/Linux 13 (trixie)If lsb_release is not installed, use /etc/os-release instead.
Check Linux Version with hostnamectl
The hostnamectl command is part of systemd. It prints hostname details and also shows the installed operating system version, which makes it a convenient one-command summary on many modern systems.
hostnamectl Static hostname: debian13
Icon name: computer-vm
Chassis: vm 🖴
Machine ID: a92099e30f704d559adb18ebc12ddac4
Boot ID: 4224ba0d5fc7489e95d0bbc7ffdaf709
Virtualization: kvm
Operating System: Debian GNU/Linux 13 (trixie)
Kernel: Linux 6.12.107+deb13-amd64
Architecture: x86-64
Hardware Vendor: QEMU
Hardware Model: Standard PC _Q35 + ICH9, 2009_
Firmware Version: 1.16.3-debian-1.16.3-2
Firmware Date: Tue 2014-04-01
Firmware Age: 12y 5month 3w 5dUse the Operating System line for the distribution version. The Kernel line shows the kernel version, which is related but not the same thing.
Check Linux Version with /etc/issue
The /etc/issue file contains the identification text shown before the login prompt. Many distributions include the version there as well.
cat /etc/issueDebian GNU/Linux 13 \n \lThis method is quick, but /etc/os-release is usually more precise and easier to parse.
Check Linux Version on Older Systems
If the commands above are not available, you are likely working with an older Linux distribution. In that case, the release files in /etc are still useful. The following command prints every file whose name ends in release:
cat /etc/*releaseThese files vary by distribution, so the output format is less consistent than /etc/os-release. Some distributions also keep their own version file, which is handy when you need the exact point release.
On stable Debian releases, the /etc/debian_version file contains the full release number:
cat /etc/debian_version13.7On Debian testing or unstable, this file may show a value such as forky/sid instead of a numbered release.
Ubuntu also ships this file, but it shows a Debian codename followed by /sid, not the Ubuntu version. Use /etc/os-release on Ubuntu instead.
On RHEL, Rocky Linux, AlmaLinux, and Fedora, read /etc/redhat-release:
cat /etc/redhat-releaseRocky Linux release 9.6 (Blue Onyx)On RHEL, Rocky Linux, and AlmaLinux, the output includes the distribution name and minor release, which /etc/os-release also shows in the VERSION_ID field. Fedora uses the same file but reports its numbered major release instead.
Check the Kernel Version with uname
The uname
command shows kernel information. Use it when you need to know which Linux kernel is running, not which distribution release is installed.
To print the kernel release, run:
uname -r6.12.107+deb13-amd64If you want a fuller kernel summary, use:
uname -srmLinux 6.12.107+deb13-amd64 x86_64The output shows that the system is running a 64-bit 6.12 kernel built by Debian.
If you need more detail about the kernel specifically, read How to Check the Kernel Version in Linux .
Troubleshooting
lsb_release: command not found
The lsb-release package is not installed. Use /etc/os-release, or install the package if you specifically need the lsb_release command.
hostnamectl is not available
Your system may not use systemd, or the command may not be installed. Use /etc/os-release or /etc/issue instead.
System has not been booted with systemd as init system (PID 1). Can’t operate.
You may see this error inside a Docker container when systemd is not running as PID 1. In that case, read /etc/os-release instead.
uname -r does not match the distro version
That is expected. uname -r shows the kernel version, while /etc/os-release, lsb_release, and hostnamectl show the Linux distribution release. Inside a container, uname -r prints the kernel of the host system, because containers share the host kernel.
FAQ
What is the best command to check Linux version?
For most systems, cat /etc/os-release is the most reliable choice because it is widely available and clearly shows the distribution name and version.
How do I check whether I am on Ubuntu, Debian, or another distribution?
Run cat /etc/os-release and look at values such as NAME, PRETTY_NAME, and ID.
How do I check the version from the desktop interface?
Most desktop environments show the operating system version in the Settings or About panel, but the exact path depends on the distribution and desktop environment.
Conclusion
You can check your Linux distribution version with /etc/os-release, hostnamectl, lsb_release, or older release files in /etc. If you need the kernel version instead, use uname -r.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 1000+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page