How to Check Linux Version

By 

Updated on

4 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
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

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: qemu
Operating System: Debian GNU/Linux 13 (trixie)
          Kernel: Linux 6.12.0-1-amd64
    Architecture: x86-64

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:

Terminal
cat /etc/*release
Terminal
cat /etc/*version

These files vary by distribution, so the output format is less consistent than /etc/os-release.

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.0-1-amd64

If you want a fuller kernel summary, use:

Terminal
uname -srm
output
Linux 6.12.0-1-amd64 x86_64

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.

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.

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 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page