How to Check OS Version in Linux (Simple Commands That Work on Every Distro)

If you’ve been working with Linux for a while or even if you’re just starting out you’ll often need to know which version of Linux you’re running.
It’s one of those small but essential details that matter when installing packages, troubleshooting, or updating your system.

Unlike Windows or macOS, Linux comes in hundreds of distributions (Ubuntu, Fedora, Debian, CentOS, etc.), and each has different versions and release names.
So knowing your exact OS version helps you find compatible software, repositories, and support solutions.

Let’s look at different ways to check your OS version in Linux whether you’re using Ubuntu, CentOS, Debian, Fedora, or any other distro.


1. Check Linux OS Version Using /etc/os-release

This is the most common and universal method.

Just open your terminal and type:

cat /etc/os-release

You’ll get output like this:

NAME="Ubuntu"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 22.04.3 LTS"
VERSION_ID="22.04"

What it shows:

  • Distro name (Ubuntu, Debian, Fedora, etc.)
  • Version number
  • Codename (e.g., Jammy Jellyfish for Ubuntu 22.04)

Why this method is great:
It works across almost all modern Linux distributions, so you can rely on it whether you’re using Ubuntu, Fedora, or Arch.


2. Use the hostnamectl Command

Another easy and neat way to check your Linux OS version is:

hostnamectl

You’ll see something like this:

Static hostname: linux-pc
Icon name: computer-laptop
Chassis: laptop
Machine ID: e3d2a…
Operating System: Ubuntu 22.04.3 LTS
Kernel: Linux 5.15.0-91-generic
Architecture: x86-64

Why it’s useful:
Along with the OS version, it also shows your system architecture, kernel version, and hostname — all in one place.

Works best for: Systemd-based distributions (Ubuntu, Fedora, Debian, etc.).


3. Check Linux Kernel Version (Optional but Useful)

Sometimes, you may not just want your OS version but also your kernel version — especially when troubleshooting hardware or driver issues.

Use:

uname -r

Example output:

5.15.0-91-generic

If you want more details:

uname -a

Example:

Linux ubuntu-pc 5.15.0-91-generic #101-Ubuntu SMP x86_64 GNU/Linux

Why it matters:
The kernel version tells you what your Linux system is built upon — newer kernels usually have better hardware support and security patches.


4. For Debian, Ubuntu, and Derivatives

Debian-based systems often include a file called lsb-release.
You can use:

lsb_release -a

Example output:

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

If lsb_release isn’t installed:

sudo apt install lsb-release

Why it’s great:
It gives a clean, human-readable output — perfect when you just want quick info.


5. For Red Hat, CentOS, and Fedora Users

If you’re using an RPM-based distribution, use:

cat /etc/redhat-release

Example output:

CentOS Stream release 9

Alternatively:

cat /etc/fedora-release

or

cat /etc/centos-release

Why this method matters:
Each RPM-based distro maintains its own release file, which gives exact version info — especially useful for server admins.


6. For Older or Minimal Systems

If none of the above files exist (in rare cases like minimal or custom builds), you can still use:

cat /proc/version

Example output:

Linux version 5.15.0-91-generic (buildd@lcy02-amd64-023) #101-Ubuntu SMP ...

This shows kernel and build details, though it won’t mention your distro directly.


7. GUI Method (For Desktop Users)

If you’re using a desktop environment (like Ubuntu GNOME or Fedora Workstation), you can check your OS version without using the terminal:

  • Ubuntu (GNOME):
    Go to Settings → About → look under OS Name or Version.
  • KDE Plasma:
    Go to System Settings → About this System.
  • Fedora Workstation:
    Settings → About → OS Name.

This is the easiest method for casual users who prefer not to type commands.


8. Check OS Version Using neofetch (For a Stylish Display)

If you want your OS version shown in a visually appealing way (with ASCII logo), install neofetch:

sudo apt install neofetch

Then run:

neofetch

Example output:

OS: Ubuntu 22.04.3 LTS x86_64 
Kernel: 5.15.0-91-generic
Uptime: 1 hour, 20 mins
Packages: 2134 (dpkg)
Shell: bash 5.1.16
Terminal: gnome-terminal
CPU: Intel i5-1135G7 (8) @ 4.2GHz
Memory: 3200MiB / 7855MiB

Why it’s cool:
Neofetch gives a nice summary of your system — OS, kernel, memory, CPU — and looks great when sharing screenshots or writing tech blogs.


Commonly Used Commands Summary

PurposeCommand
General OS infocat /etc/os-release
Hostname + OS infohostnamectl
LSB release infolsb_release -a
Kernel versionuname -r
RedHat/CentOS versioncat /etc/redhat-release
GUI check (Desktop)Settings → About
Stylish viewneofetch

Which Command Should You Use?

Here’s a quick recommendation depending on your setup:

  • For all Linux distros: cat /etc/os-release
  • For Ubuntu/Debian: lsb_release -a
  • For CentOS/Fedora: cat /etc/redhat-release
  • For quick kernel check: uname -r
  • For desktop users: Check via Settings → About
  • For fun look: Use neofetch

If you’re not sure, start with /etc/os-release — it works almost everywhere.


Why Checking OS Version in Linux Matters

Knowing your OS version helps when you:

  • Install compatible software or drivers
  • Add correct repositories
  • Follow troubleshooting steps online
  • Upgrade or patch your system
  • Automate tasks across multiple servers

For example, when you follow online guides or Stack Overflow answers, many solutions depend on your exact version — Ubuntu 20.04 vs 22.04 can have different package names or dependencies.

So, even though it’s a small command, it saves a lot of confusion and mistakes.


Conclusion

Linux gives you multiple ways to check your OS version from simple terminal commands to GUI methods.
The most reliable one is:

cat /etc/os-release

But if you want something fancy or detailed, try hostnamectl or neofetch.

Knowing your Linux version is a basic yet powerful skill. Whether you’re configuring a server, debugging an issue, or just curious about your system, these commands will always come in handy.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *