Every Linux system runs on a kernel. That kernel carries a specific release tag — a set of digits that tells you exactly which build your machine runs. Knowing how to get Linux version details helps you apply the right security patches, confirm package compatibility, and meet team policy requirements. This guide covers the most reliable commands for Ubuntu, Fedora, Debian, OpenSUSE, and other distributions.

What “Linux Version” Actually Means

The phrase covers two distinct things. Your distribution — Ubuntu, Fedora, Debian, or RHEL — is the named OS package with its own release schedule. The kernel is the underlying software layer managing hardware. Both carry separate version numbers.

A command like uname -r returns only kernel data. lsb_release -a returns distribution details. Commands like hostnamectl return both. Knowing which one you need prevents running the wrong tool entirely. The kernel version follows the major.minor.patch format — for example, 5.15.46 — while the distro version follows whatever release scheme that distribution uses, such as Ubuntu 22.04 or Fedora 39.

How to Check Linux Version with cat /etc/os-release

Reading /etc/os-release is the most portable method to check the Linux OS version. The file exists on virtually all modern distributions and requires no additional tools. Run:

$ cat /etc/os-release

Sample output on Ubuntu 22.04:

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

The PRETTY_NAME line gives the human-readable release string. VERSION_ID holds the numeric release number useful for scripting. If you only need the pretty name, run:

$ grep PRETTY_NAME /etc/os-release

The os-release file format specification documents each variable in detail, useful when parsing specific fields inside a shell script.

How to Get Linux Version with uname

The uname command returns kernel-specific information. For just the kernel release number:

$ uname -r

For a full line including the hostname, build date, and CPU architecture:

$ uname -a

Sample output: Linux myhost 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Flag What it prints Example output
uname -r Kernel release only 5.15.0-91-generic
uname -v Kernel version string #101-Ubuntu SMP Tue Nov 14…
uname -m Machine hardware type x86_64
uname -a All information combined Full system string

The uname man page covers every available flag, including -p for processor architecture — useful when selecting the right software package to download.

How to Get Linux Version Using hostnamectl

On systemd-based systems, hostnamectl returns both the OS distribution name and the kernel version in a single command. Run:

$ hostnamectl

Sample output:

Static hostname: myserver Operating System: Ubuntu 22.04.3 LTS Kernel: Linux 5.15.0-91-generic Architecture: x86-64

Look for the “Operating System” line for the distro version and “Kernel” for the kernel build. This command pulls data from systemd logs tied to the machine’s hostname. It does not work on distributions without systemd — older Debian installs or Alpine Linux, for example. If hostnamectl is unavailable, fall back to cat /etc/os-release.

How to Check Linux OS Version with lsb_release

The lsb_release command returns distributor ID, release number, and codename. It follows the Linux Standard Base specification, which is why the command works consistently across distributions that have it installed.

$ lsb_release -a

Output on Ubuntu:

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

The lsb_release man page lists all flags, including -d for description-only output. If the tool is absent, install it via apt install lsb-release on Debian-based systems or dnf install redhat-lsb-core on Fedora.

How to Get Linux Version on Specific Distributions

Ubuntu: Get the Mainline Kernel Tag

On Ubuntu, the more detailed command is:

$ cat /proc/version_signature

Output example: 5.15.0-47.51-generic 5.15.46. The trailing group 5.15.46 is the mainline kernel tag — what upstream kernel.org assigned. This differs from Ubuntu’s packaging string. Use this value when a security posture monitor or compliance tool asks for the kernel version.

Field Example Meaning
Full output 5.15.0-47.51-generic 5.15.46 Complete signature
Mainline tag 5.15.46 Upstream kernel build

Fedora: Read the Kernel Release

$ uname -r

Sample output: 5.18.13-200.fc36.x86_64. The first three digits — 5.18.13 — are the mainline kernel tag. Everything after the hyphen is Fedora’s packaging suffix.

Field Example Meaning
Full output 5.18.13-200.fc36.x86_64 Fedora-specific string
Mainline tag 5.18.13 Upstream kernel build

Debian: Extract the Mainline Tag from uname -a

$ uname -a

Output: Linux myhost 5.10.0-16-amd64 #1 SMP Debian 5.10.127-2 (2022-07-23) x86_64 GNU/Linux. The section Debian 5.10.127 holds the mainline kernel tag. Debian’s kernel handbook covers version types and ABIs in more detail if you need to track specific stable release branches.

Field Example Meaning
Distro label Debian 5.10.127-2 Debian’s patched release
Mainline tag 5.10.127 Upstream kernel build

OpenSUSE

$ uname -r

Output example: 5.19.2-1-default. The digits 5.19.2 are the mainline kernel tag. OpenSUSE’s Kernel Portal has additional resources on their versioning scheme and release cadence.

Other Distributions

Not all distributions use the same file layout or packaging conventions. Check distro-specific documentation first. As a fallback, uname -r works on nearly every system. Alternatively, cat /proc/version reads directly from the kernel’s own reporting interface and does not depend on any distribution tooling. The kernel command line reference covers what the kernel exposes at the system level.

How to Check Linux Version Remotely via SSH

SSH into the remote machine and run any of the standard commands. No special setup is needed — uname -r, cat /etc/os-release, and hostnamectl all work over a remote session the same way they do locally. Confirm you have authentication credentials and the right access level before connecting. On servers without a GUI, this is the only practical method anyway.

Quick Reference: Linux Version Commands by Distribution

Distribution Command Sample Mainline Tag
Ubuntu cat /proc/version_signature 5.15.46
Fedora uname -r 5.18.13
Debian uname -a 5.10.127
OpenSUSE uname -r 5.19.2
Any distro cat /etc/os-release N/A (shows distro version)
Systemd systems hostnamectl Both distro + kernel

For shells running on remote machines, learning the how to run a shell script workflow helps automate version checks across multiple hosts. If you work across systems regularly, setting up bash aliases for commands you type often saves time. And once you know how to get Linux version details, pairing that with server reboot procedures keeps systems current after kernel updates.

FAQs

What is the fastest command to check Linux version?

cat /etc/os-release is the most reliable single command. It works on virtually all modern distributions without any additional tools and returns the distribution name and version clearly.

Does uname -r show the Linux distro version or the kernel version?

uname -r shows only the kernel version, not the distribution version. To get the distro name and release number, use cat /etc/os-release or lsb_release -a instead.

How do I check the Linux version without root access?

All standard version commands — uname -r, cat /etc/os-release, hostnamectl, and lsb_release -a — work as a regular user without sudo or root privileges.

Why does my kernel version differ from my Ubuntu version?

Ubuntu packages a modified kernel with its own numbering. The Ubuntu version (e.g., 22.04) reflects the distribution release, while the kernel version (e.g., 5.15.0-91) reflects the specific build Canonical ships for that release.

Can I check the Linux version on a remote machine?

Yes. SSH into the remote machine and run uname -r, cat /etc/os-release, or hostnamectl. These commands work identically over SSH without any extra configuration.

Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.