Skip to main content

Command Palette

Search for a command to run...

How to Find Version of OS in Linux

Published
6 min readView as Markdown

Finding the version of your Linux operating system is a common task that can help you troubleshoot issues, install compatible software, or simply stay informed about your system. Whether you're a beginner or an experienced user, knowing how to check your Linux OS version is essential. In this article, I’ll guide you through several easy methods to find your Linux OS version quickly.

You don’t need to be a command-line expert to get this information. I’ll explain simple commands and tools you can use, along with examples. By the end, you’ll feel confident checking your Linux version anytime you want.

Why Knowing Your Linux OS Version Matters

Understanding your Linux OS version helps you in many ways. For example, some software requires a minimum OS version to run properly. Also, when seeking help online or reporting bugs, knowing your exact OS version makes communication clearer.

Here are some reasons why you should know your Linux version:

  • Software compatibility: Ensures you install compatible applications.
  • Security updates: Helps you verify if your system is up to date.
  • Troubleshooting: Assists in diagnosing system problems.
  • Documentation: Useful when following guides or tutorials.

Now, let’s explore how you can find this information using different commands and files.

Using the lsb_release Command

The lsb_release command is one of the most straightforward ways to check your Linux OS version. It provides detailed information about your distribution.

To use it, open your terminal and type:

lsb_release -a

This command outputs several lines, including:

  • Distributor ID (e.g., Ubuntu, Fedora)
  • Description (full OS name)
  • Release (version number)
  • Codename (version codename)

For example:

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

If you want just the version number, use:

lsb_release -r

What if lsb_release is not installed?

Some minimal Linux installations don’t have lsb_release by default. You can install it using your package manager:

  • On Debian/Ubuntu:

    sudo apt-get install lsb-release
    
  • On Fedora:

    sudo dnf install redhat-lsb-core
    

Once installed, rerun the command.

Checking the /etc/os-release File

Most modern Linux distributions include a file called /etc/os-release. This file contains key information about the OS version in a simple text format.

To view it, run:

cat /etc/os-release

You’ll see output like this:

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

This file is very useful because it works across many distributions, including Ubuntu, Debian, Fedora, and others.

Quick way to get just the version

If you want only the version number, use:

grep VERSION_ID /etc/os-release

This will output something like:

VERSION_ID="22.04"

Using the hostnamectl Command

The hostnamectl command is primarily used to manage the system hostname, but it also shows OS information.

Run:

hostnamectl

You’ll get output similar to:

   Static hostname: mycomputer
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 1234567890abcdef
           Boot ID: abcdef1234567890
  Operating System: Ubuntu 22.04.2 LTS
            Kernel: Linux 5.15.0-60-generic
      Architecture: x86-64

Look for the “Operating System” line to find your Linux version.

This method is convenient because it also shows kernel and architecture details.

Checking the Kernel Version with uname

Sometimes, you might want to know the Linux kernel version rather than the distribution version. The kernel is the core part of the OS.

Use:

uname -r

This outputs something like:

5.15.0-60-generic

While this doesn’t tell you the distribution version, it’s useful for troubleshooting hardware or driver issues.

If you want more detailed system info, try:

uname -a

This shows kernel version, hostname, architecture, and more.

Viewing Release Files in /etc

Older Linux distributions or some specific ones use files in /etc to store version info. Common files include:

  • /etc/issue
  • /etc/*release
  • /etc/*version

To list these files, run:

ls /etc/*release /etc/*version

You might see files like /etc/redhat-release or /etc/debian_version.

To view a specific file, use cat. For example:

cat /etc/redhat-release

This might output:

Red Hat Enterprise Linux Server release 8.6 (Ootpa)

These files are helpful if other methods don’t work.

Using GUI Tools to Check Linux Version

If you prefer not to use the terminal, many Linux desktop environments provide graphical tools to check OS info.

Here’s how to find it on popular desktops:

  • GNOME: Open “Settings” > “About.” You’ll see OS name, version, and hardware info.
  • KDE Plasma: Go to “System Settings” > “About System.”
  • XFCE: Open “Settings” > “About XFCE” or check “System Info.”

These GUI methods are user-friendly and great for beginners.

Summary Table of Commands to Find Linux OS Version

Command or FileDescriptionExample Output
lsb_release -aDetailed distro infoUbuntu 22.04.2 LTS (Jammy Jellyfish)
cat /etc/os-releaseOS info in text fileVERSION="22.04.2 LTS"
hostnamectlOS and kernel infoOperating System: Ubuntu 22.04.2 LTS
uname -rKernel version5.15.0-60-generic
cat /etc/redhat-releaseRed Hat specific release fileRed Hat Enterprise Linux 8.6
GUI Settings (varies)OS info via desktop environmentUbuntu 22.04.2 LTS

Tips for Checking Linux Version on Servers

If you manage remote Linux servers, knowing the OS version helps with updates and security.

Here are some tips:

  • Use SSH to connect and run commands like lsb_release -a.
  • Automate version checks with scripts.
  • Check kernel and distro versions before applying patches.
  • Keep a record of OS versions across servers for inventory.

Troubleshooting Common Issues

Sometimes, commands might not work as expected. Here’s what to do:

  • If lsb_release is missing, install the package.
  • If /etc/os-release is missing, try other files like /etc/issue.
  • For minimal systems, kernel info via uname is always available.
  • Use GUI tools if terminal commands are confusing.

Conclusion

Now you know several ways to find the version of your Linux operating system. Whether you prefer command-line tools like lsb_release, checking files like /etc/os-release, or using graphical interfaces, there’s a method for everyone.

Knowing your Linux version helps with software compatibility, security, and troubleshooting. Next time you need this info, just pick the method that suits you best and get the details quickly. Linux makes it easy to stay informed about your system.


FAQs

How do I find the Linux OS version using the terminal?

You can use the lsb_release -a command or view the /etc/os-release file with cat /etc/os-release to find your Linux OS version in the terminal.

What is the difference between OS version and kernel version?

The OS version refers to the Linux distribution release (like Ubuntu 22.04), while the kernel version is the core system software version (like 5.15.0-60).

Can I find Linux version without using commands?

Yes, most desktop environments have GUI tools under “Settings” or “About” that display your Linux OS version.

What if lsb_release command is not found?

You can install it using your package manager, for example, sudo apt-get install lsb-release on Debian-based systems.

Why is knowing my Linux version important?

It helps ensure software compatibility, security updates, and effective troubleshooting by providing accurate system information.

More from this blog

L

LinuxBloke | Linux Tips, Tricks & Troubleshooting

672 posts