Skip to main content

Command Palette

Search for a command to run...

How to Find Linux OS Version

Updated
5 min read

Finding out which Linux OS version you’re running is a common task, whether you’re troubleshooting, installing software, or just curious. If you’re new to Linux or even an experienced user, knowing how to quickly check your OS version can save you time and help you get the right support or updates.

In this article, I’ll walk you through several easy methods to find your Linux OS version. We’ll cover command-line tools, graphical options, and some tips for different Linux distributions. By the end, you’ll feel confident checking your Linux version anytime you need.

Why Knowing Your Linux OS Version Matters

Understanding your Linux OS version is important for several reasons:

  • Software compatibility: Some applications require specific Linux versions or kernels.
  • Security updates: Knowing your version helps you apply the right patches.
  • Troubleshooting: Support forums often ask for your OS details.
  • System management: Helps in planning upgrades or migrations.

Linux comes in many flavors, called distributions (distros), like Ubuntu, Fedora, Debian, and CentOS. Each distro has its own way of showing version info, but many commands work across all.

Using Command Line to Find Linux OS Version

The command line is the fastest way to check your Linux version. Here are the most common commands you can use.

1. lsb_release Command

The lsb_release command is designed to provide Linux Standard Base and distribution-specific information.

lsb_release -a

This command outputs:

  • Distributor ID (e.g., Ubuntu)
  • Description (e.g., Ubuntu 22.04.1 LTS)
  • Release number (e.g., 22.04)
  • Codename (e.g., jammy)

If you want just the version number, use:

lsb_release -r

This command works on most modern Linux distros but may require installing the lsb-release package on some systems.

2. Checking /etc/os-release File

Most Linux distros include a file called /etc/os-release that contains version info.

cat /etc/os-release

This displays detailed info like:

  • NAME (e.g., Ubuntu)
  • VERSION (e.g., 22.04.1 LTS)
  • ID (e.g., ubuntu)
  • VERSION_ID (e.g., 22.04)

This file is a reliable source and works on almost all Linux systems.

3. Using /etc/issue File

Another quick way is to check the /etc/issue file:

cat /etc/issue

This usually shows a brief version message displayed before login, such as:

Ubuntu 22.04.1 LTS \n \l

It’s less detailed but handy for a quick glance.

4. Using hostnamectl Command

On systems running systemd, hostnamectl provides OS and kernel info:

hostnamectl

Look for the “Operating System” line, which shows your Linux distro and version.

5. Checking Kernel Version with uname

While not the OS version, knowing your kernel version is useful:

uname -r

This shows the Linux kernel version, such as 5.15.0-70-generic.

Graphical Ways to Find Linux OS Version

If you prefer not to use the terminal, many Linux desktop environments provide GUI tools to check your OS version.

1. Using System Settings

Most distros have a “Settings” or “About” section:

  • Ubuntu (GNOME): Open “Settings” > “About” to see OS name and version.
  • Fedora: Go to “Settings” > “Details.”
  • Linux Mint: Open “System Info” from the menu.

This method is user-friendly and shows additional system info like RAM and CPU.

2. Using System Monitor Tools

Some distros include system monitors that display OS info:

  • KDE Plasma: Use “Info Center” from the application launcher.
  • GNOME: Use “GNOME System Monitor” and check the “System” tab.

These tools often provide hardware and software details in one place.

Finding Version on Different Linux Distributions

Different Linux distros may have slight variations in how they store or display version info.

DistributionCommon Command/File for Version Info
Ubuntulsb_release -a, /etc/os-release
Debian/etc/debian_version, lsb_release -a
Fedoracat /etc/fedora-release, hostnamectl
CentOScat /etc/centos-release, lsb_release
Arch Linuxcat /etc/arch-release, lsb_release

If a command doesn’t work, try checking the distro-specific release file in /etc.

Troubleshooting Common Issues

Sometimes, commands like lsb_release may not be installed by default. Here’s how to fix that:

  • On Debian/Ubuntu:
sudo apt update
sudo apt install lsb-release
  • On Fedora:
sudo dnf install redhat-lsb-core

If you get permission errors when reading files, try using sudo or check your user privileges.

Automating OS Version Checks in Scripts

If you manage multiple Linux machines, automating version checks can be helpful.

Here’s a simple bash script snippet to get OS info:

#!/bin/bash
if [ -f /etc/os-release ]; then
  . /etc/os-release
  echo "You are running $NAME version $VERSION"
else
  echo "Cannot find OS version info."
fi

This script sources /etc/os-release and prints the OS name and version.

Summary Table of Commands to Find Linux OS Version

CommandDescriptionWorks On
lsb_release -aDetailed distro infoMost distros
cat /etc/os-releaseOS and version info fileAlmost all distros
cat /etc/issueBrief version infoMost distros
hostnamectlOS and kernel info (systemd)systemd-based distros
uname -rKernel versionAll Linux systems

Conclusion

Now you know several reliable ways to find your Linux OS version. Whether you prefer the command line or graphical tools, checking your Linux version is quick and straightforward. This knowledge helps you manage your system better, install compatible software, and troubleshoot issues effectively.

Remember, Linux distributions vary, but commands like lsb_release and files like /etc/os-release are your best friends. Keep these tips handy, and you’ll always be able to identify your Linux OS version with ease.


FAQs

How do I find the Linux kernel version?

Use the command uname -r in the terminal. It shows the kernel version currently running on your system.

What if lsb_release command is not found?

You may need to install it. On Ubuntu/Debian, run sudo apt install lsb-release. On Fedora, use sudo dnf install redhat-lsb-core.

Can I find Linux version without using the terminal?

Yes, most desktop environments have a “Settings” or “About” section that shows OS version information.

Where is Linux version info stored?

Most Linux distros store version info in /etc/os-release or distro-specific files like /etc/centos-release.

Does the kernel version equal the OS version?

No, the kernel version shows the Linux kernel release, while the OS version refers to the distribution and its release number.

More from this blog

L

LinuxBloke | Linux Tips, Tricks & Troubleshooting

672 posts