How to Check Linux Version: Distro and Kernel Commands

By 

•

Updated on

•

5 min read

Check Linux Version

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

MethodCommandBest For
Recommendedcat /etc/os-releaseMost modern Linux distributions
Short summaryhostnamectlsystemd-based systems
LSB outputlsb_release -aSystems with lsb-release installed
Older systemscat /etc/*releaseOlder distributions without os-release
Kernel onlyuname -rLinux 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.

Terminal
cat /etc/os-release
output
PRETTY_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:

Terminal
grep PRETTY_NAME /etc/os-release
output
PRETTY_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.

Terminal
lsb_release -a
output
Distributor ID:	Debian
Description:	Debian GNU/Linux 13 (trixie)
Release:	13
Codename:	trixie

The distribution name and version appear on the Description line. To show only that line, run:

Terminal
lsb_release -d
output
Description:	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.

Terminal
hostnamectl
output
 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 5d

Use 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.

Terminal
cat /etc/issue
output
Debian GNU/Linux 13 \n \l

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

Terminal
cat /etc/*release

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

Terminal
cat /etc/debian_version
output
13.7

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

Terminal
cat /etc/redhat-release
output
Rocky 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:

Terminal
uname -r
output
6.12.107+deb13-amd64

If you want a fuller kernel summary, use:

Terminal
uname -srm
output
Linux 6.12.107+deb13-amd64 x86_64

The 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.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

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