How To Check Your Linux OS Version (Simple Commands That Work Everywhere)

Knowing which Linux version you’re running matters more than it might seem. It affects:

  • Which apps you can install
  • Which tutorials or troubleshooting steps apply to you
  • Whether you’re still getting security updates

The good news: Linux makes this fairly easy to check. The slightly confusing part: there isn’t just one command. Different distributions (distros) and setups can show this info in slightly different ways.

This guide walks through the most reliable ways to check your Linux OS version, explains what each piece of information means, and shows how that can vary from system to system.


What “Linux Version” Actually Means

When people say “Linux version,” they might mean a few different things:

  • Distribution (distro) name – e.g. Ubuntu, Debian, Fedora, Arch, Linux Mint
  • Distro version – e.g. Ubuntu 22.04, Debian 12, Fedora 40
  • Edition / flavor – e.g. Ubuntu Desktop vs Ubuntu Server, Kubuntu vs Xubuntu
  • Kernel version – e.g. Linux 6.1.0-20-amd64

Most everyday tasks (installing software, following a guide) depend on the distro name and version, not just the kernel. Kernel version matters more for hardware support and low-level troubleshooting.

When you “check OS version” in Linux, you’re usually reading from system files under /etc that your distro maintains.


Quick Commands To Check Your Linux OS Version

Here are the most commonly useful commands. You can try them all; they’re safe to run in a terminal.

1. Use cat /etc/os-release (Works on Most Modern Distros)

This is one of the most standard ways on modern systems:

cat /etc/os-release 

You’ll see lines like:

NAME="Ubuntu" VERSION="22.04.4 LTS (Jammy Jellyfish)" ID=ubuntu VERSION_ID="22.04" PRETTY_NAME="Ubuntu 22.04.4 LTS" 

Key fields:

  • NAME / PRETTY_NAME – Human-readable distro name
  • VERSION / VERSION_ID – The version number (and sometimes codename)
  • ID – Short identifier used by scripts or tools

If this file exists and has data, you already know the distro and version.

2. Use lsb_release (Common on Ubuntu, Debian, Mint, etc.)

On many Debian-based systems (Ubuntu, Linux Mint, Pop!_OS), you can run:

lsb_release -a 

You might see:

Distributor ID: Ubuntu Description: Ubuntu 22.04.4 LTS Release: 22.04 Codename: jammy 

Useful fields:

  • Distributor ID – Distro family (e.g. Ubuntu, Debian)
  • Description – User-friendly name and version
  • Release – Version number
  • Codename – Release codename (used in some guides and repos)

If lsb_release isn’t found, you can often install it from your package manager (on Debian/Ubuntu: sudo apt install lsb-release), though that depends on your setup and permissions.

3. Use hostnamectl (On systemd-Based Systems)

If your distro uses systemd (most mainstream ones do), try:

hostnamectl 

Typical output includes:

Operating System: Ubuntu 22.04.4 LTS Kernel: Linux 6.5.0-27-generic Architecture: x86-64 

You get both the OS name/version and kernel version in one shot.

4. Check /etc/*release Files (Fallback for Older Distros)

On older or more minimal installations, /etc/os-release might not exist, but these might:

cat /etc/*release 

This command prints any file ending in “release” under /etc, such as:

  • /etc/redhat-release (Red Hat, CentOS)
  • /etc/centos-release
  • /etc/debian_version

You’ll usually see some mix of distro name and version.


How To Check the Linux Kernel Version

If you specifically need the kernel version (e.g., debugging hardware drivers):

uname -r 

Example output:

6.5.0-27-generic 

To see more detail:

uname -a 

You’ll get something like:

Linux myhost 6.5.0-27-generic #28-Ubuntu SMP ... x86_64 GNU/Linux 

Remember:

  • Kernel version is different from your distro version.
  • You can have the same distro version with different kernel versions depending on updates or custom kernels.

Desktop vs Server vs Minimal Systems: Why Results Differ

Not every Linux machine behaves the same way. A few factors change what you’ll see and which commands work.

1. Desktop Distributions

On a typical desktop distro (Ubuntu Desktop, Linux Mint, Fedora Workstation):

  • /etc/os-release is almost always present.
  • lsb_release -a often works out of the box.
  • hostnamectl usually shows a clean “Operating System” line.

These systems are designed to be user-friendly and consistent for tools and graphical utilities.

2. Server Distributions

On servers (Ubuntu Server, Debian Server, CentOS Stream, Rocky Linux):

  • /etc/os-release and a distro-specific -release file are usually reliable.
  • lsb_release might not be installed by default on minimal servers.
  • Cloud images may have slightly customized info, like “Ubuntu 22.04.4 LTS (GNU/Linux 6.5.0-1017-azure x86_64)”.

Admins often rely on these files for automation and inventory scripts.

3. Minimal / Embedded / Container Images

In very small or specialized systems:

  • Some files may be missing to save space.
  • Containers (like Docker images) might report only minimal info.
  • lsb_release may not exist at all.

In these cases, /etc/os-release and kernel info from uname are often your only clues, and sometimes even that’s limited depending on how the environment was built.


Common Distros and Where Version Info Lives

Here’s a quick reference for some popular distributions:

Distro FamilyTypical Version File(s)Useful Commands
Ubuntu / Linux Mint/etc/os-releaselsb_release -a, hostnamectl
Debian/etc/os-release, /etc/debian_versionlsb_release -a
Fedora/etc/os-releasehostnamectl
Red Hat / CentOS/etc/os-release, /etc/redhat-releasecat /etc/redhat-release
Arch Linux/etc/os-releasehostnamectl
openSUSE/etc/os-releasehostnamectl

This table is a guide, not a guarantee—individual systems can be customized.


Why OS Version Matters for Day-to-Day Use

Once you know your Linux OS version, it directly affects what you can safely follow or install.

Software Installation and Repositories

Package managers (like apt, dnf, pacman, zypper) and third-party packages often support only certain distro versions. For example:

  • A PPA or third-party repo might support Ubuntu 22.04 but not 18.04.
  • A .deb or .rpm download might be built for a specific Debian or RHEL version.

If you follow instructions meant for another version, you can hit:

  • Dependency errors
  • Broken packages
  • Older or incompatible software

Knowing your precise distro and version helps you pick the right repository or installer.

Security Updates and Support Lifespan

Linux distributions have support windows:

  • Some versions are LTS (Long-Term Support) and get security updates for years.
  • Others are short-lived and age out quickly.

If your os-release or lsb_release shows something like “Ubuntu 16.04” or “Fedora 32,” that may indicate:

  • You’re beyond mainstream support.
  • Security patches might be limited or unavailable.

Whether that’s acceptable depends on how the system is used, what’s exposed to the internet, and your security requirements.

Hardware and Kernel Compatibility

Kernel version affects:

  • Whether new hardware (GPUs, Wi‑Fi chips, SSD controllers) is fully supported
  • Availability of specific drivers or modules
  • Certain performance improvements or power-saving features

A newer kernel isn’t automatically “better” for every system, but the combination of distro version and kernel version determines what your machine can handle smoothly.


Different User Profiles, Different Needs From This Info

The same “OS version” information gets used very differently depending on who you are and what you’re doing.

Casual Desktop User

Likely priorities:

  • “Will this app install on my system?”
  • “Does this tutorial match my version of Ubuntu/Fedora/etc.?”

For that, PRETTY_NAME in /etc/os-release or lsb_release -a is usually all that’s needed.

Gamer or Power User

Might care more about:

  • Kernel version for graphics drivers or game performance
  • Graphics stack versions, Mesa versions, etc. (indirectly tied to OS version)

Knowing both distro version and kernel version helps judge whether an upgrade or change might help with performance or compatibility.

Developer

Needs OS version info to:

  • Match library and compiler versions with deployment targets
  • Reproduce bugs and environments (e.g. “Build passes on Ubuntu 22.04 but fails on 20.04”)

The exact version string from /etc/os-release and maybe additional details (like ID, VERSION_ID) can matter for automation scripts and containers.

System Administrator

Often needs to know:

  • Which systems are running which distro versions
  • Which ones are near or past end-of-life
  • Which kernel versions are affected by certain security advisories

Here, OS version info feeds into inventory tools, update plans, and compliance checks.


The Missing Piece: Your Own Linux Setup

The commands to check your Linux OS version are straightforward. Between:

  • cat /etc/os-release
  • lsb_release -a
  • hostnamectl
  • uname -r

you can almost always discover your distro name, distro version, and kernel version.

What you do with that information depends entirely on:

  • Whether you’re on a desktop, laptop, server, or container
  • How critical security updates are for your specific machine
  • Which software you want to run and what versions it supports
  • How comfortable you are with upgrades, kernel changes, or distro hops

The version details are just the starting point; the right next step depends on your particular Linux environment and what you’re trying to achieve with it.