Whether you are setting up a new server, troubleshooting a package conflict, or verifying compatibility before an update, knowing how to check the Linux version on your system is something you will need more than once. The answer depends on what you are actually looking for — the distribution name, its release number, or the kernel beneath it. These are separate things, and different commands return different parts of that picture.

What “Linux Version” Actually Means

The phrase “Linux version” covers two different things. Your distribution — Ubuntu, Fedora, Debian, Mint, or RHEL — is the named OS package with its own release schedule and software repositories. The kernel is the underlying software layer that manages hardware, separate from the distribution name entirely.

A command like uname -r only returns kernel data. lsb_release -a returns distribution details. Some commands show both at once. Knowing which one you need saves time and avoids running the wrong tool.

How to Check Linux Version: Six Methods

There are six reliable ways to check the Linux OS version or kernel from the command line. Which one works best depends on your distribution and what information you need.

Command compatibility across major Linux distributions
Command
Ubuntu
Debian
Fedora
RHEL
Alpine
lsb_release -a
Yes
Yes
Yes
Install
No
cat /etc/os-release
Yes
Yes
Yes
Yes
Yes
uname -r
Yes
Yes
Yes
Yes
Yes
hostnamectl
Yes
Yes
Yes
Yes
No
cat /etc/issue
Yes
Yes
Varies
Varies
Varies
cat /proc/version
Yes
Yes
Yes
Yes
Yes

1. Check Linux Version with lsb_release

lsb_release -a

LSB stands for Linux Standard Base. This command returns the distributor ID, description, release number, and codename in a single output. It works across Ubuntu, Debian, Fedora, and most common distributions without additional configuration.

If the command is not found, the tool is not installed by default on that system. The full list of available output flags documents how to filter for individual fields if you only need the release number or distributor ID. Not all distributions ship it, so having a fallback is worth knowing.

2. Check Linux Version Using /etc/os-release

cat /etc/os-release

This file exists on nearly every modern Linux system and outputs structured data: OS name, version, ID, and additional metadata. It works on Ubuntu, Debian, Fedora, Red Hat, CentOS, and Alpine without needing any extra tools installed, which makes it one of the most portable options.

The os-release file format specification documents each variable in detail, useful when you need to parse specific fields inside a shell script. If lsb_release is unavailable, start here.

3. Check Linux Kernel Version with uname

uname -a

This returns a full line of system information covering the kernel name, hostname, kernel release number, compile date, and CPU architecture. To get just the kernel version, use the shorter form:

uname -r

Here is what each field in uname -a output means:

FieldExample ValueMeaning
Kernel nameLinuxThe kernel type
Hostnameserver01Machine name
Kernel release5.14.0-162.el9.x86_64Kernel version number
Compile info#1 SMP Tue Nov 15 2022When the kernel was built
Architecturex86_64CPU type (64-bit)
OSGNU/LinuxFull OS name

The complete uname flag reference covers every available option, including -m for machine hardware type and -p for processor architecture — both useful when selecting the right software package to download.

4. Using hostnamectl to Check Linux Version

hostnamectl

On Systemd-based systems, this is the fastest single command for seeing both the OS distribution name and kernel version together. Look for the “Operating System” and “Kernel” lines in the output. It pulls from Systemd logs tied to the machine’s hostname.

The documentation for controlling the system hostname explains additional subcommands for querying and setting hostname-related settings. One limitation: this command does not work on older distributions or systems that do not use Systemd as their init system.

5. Using the /etc/issue File

cat /etc/issue

This file contains the message shown to users before a login prompt. It usually holds a short OS identification string — a quick read when you do not need full distribution metadata. The output is brief but consistent on most systems.

On some distributions, /etc/issue contains placeholder text rather than actual version data. In those cases, /etc/os-release is the more reliable choice.

6. Using cat /proc/version

cat /proc/version

This reads directly from the proc virtual filesystem and combines content from three kernel files: ostype, osrelease, and version. The output includes the kernel version and build metadata — a solid fallback when other commands are unavailable, since it works regardless of what is installed on the system.

The cat command reference for concatenating files to standard output covers how to chain file reads and filter output in scripts, which is practical when pulling data from multiple proc entries at once.

Quick Reference: Linux Version Commands

GoalCommand
See both OS name and kernelhostnamectl
Distribution details with codenamelsb_release -a
Standard OS info filecat /etc/os-release
Kernel version onlyuname -r
All kernel detailsuname -a
Kernel from proc filesystemcat /proc/version
Very old systemscat /etc/*release

FAQs

What is the fastest command to check the Linux version?

On Systemd-based systems, hostnamectl returns both the OS name and kernel version in one output. On any distribution, cat /etc/os-release is the most portable single command and requires no additional tools.

How do I check the Linux kernel version only?

Run uname -r in the terminal. It outputs only the kernel release number, such as 5.15.0-91-generic. For the full kernel line including architecture and build date, use uname -a instead.

How do I check the Linux version without lsb_release?

Use cat /etc/os-release, which works on virtually all modern distributions without any tool installed. On very old systems where that file is absent, try cat /etc/*release or cat /proc/version as fallbacks.

Can I check the Linux OS version remotely over SSH?

Yes. SSH into the remote machine and run any of the standard commands — uname -r, cat /etc/os-release, or hostnamectl. Ensure you have authentication credentials and sufficient access permissions before connecting.

What is the difference between the Linux distribution version and kernel version?

The distribution version identifies the named OS release, such as Ubuntu 22.04 or Fedora 39. The kernel version is a separate number identifying the core software layer managing hardware. Both change independently on their own release schedules.

Image

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.