Skip to main content

Command Palette

Search for a command to run...

How to Check Linux Version

Updated
6 min read

Checking your Linux version is a basic yet essential task for anyone using a Linux system. Whether you’re troubleshooting, installing software, or just curious about your system, knowing the exact Linux version helps you make informed decisions. In this article, I’ll guide you through several easy ways to find out your Linux version quickly.

You don’t need to be a Linux expert to follow along. I’ll explain each method step-by-step, using simple commands and tools that work on most Linux distributions. By the end, you’ll feel confident checking your Linux version anytime you want.

Why Knowing Your Linux Version Matters

Understanding your Linux version is important for several reasons:

  • Software compatibility: Some programs require specific Linux versions or kernel versions.
  • Security updates: Knowing your version helps you check if your system is up to date.
  • Troubleshooting: When seeking help, sharing your Linux version helps others assist you better.
  • System management: Different versions may have different features or commands.

Linux comes in many flavors, called distributions (distros), like Ubuntu, Fedora, Debian, and CentOS. Each distro can have multiple versions, so it’s useful to know exactly which one you’re running.

How to Check Linux Version Using Command Line

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

Using the lsb_release Command

The lsb_release command provides Linux Standard Base and distribution-specific information.

  • Open your terminal.
  • Type the command:

    lsb_release -a
    
  • You will see output like this:

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

This output tells you the distro name, version number, and codename. It works on most popular distros like Ubuntu, Debian, and Fedora.

If you get a “command not found” error, you may need to install the lsb-release package:

sudo apt install lsb-release   # For Debian/Ubuntu
sudo dnf install redhat-lsb-core  # For Fedora

Checking the /etc/os-release File

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

  • Run this command:

    cat /etc/os-release
    
  • You’ll see output similar to:

    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 a reliable source for distro name and version. It’s available on almost all Linux systems.

Using the hostnamectl Command

The hostnamectl command shows system information, including the OS version.

  • Type:

    hostnamectl
    
  • Look for the “Operating System” line:

    Operating System: Ubuntu 22.04.2 LTS
    Kernel: Linux 5.15.0-60-generic
    

This command is handy because it also shows kernel version and hostname.

Viewing the Kernel Version with uname

Sometimes you want to know the Linux kernel version specifically.

  • Run:

    uname -r
    
  • Example output:

    5.15.0-60-generic
    

This tells you the kernel version, which is important for hardware compatibility and performance.

If you want more detailed kernel info, use:

uname -a

This shows the kernel name, version, architecture, and more.

Checking Linux Version Using GUI Tools

If you prefer not to use the terminal, many Linux desktop environments provide graphical ways to check your version.

Ubuntu and GNOME

  • Click the system menu (top-right corner).
  • Select Settings.
  • Scroll down and click About.
  • You’ll see your OS name and version displayed.

KDE Plasma

  • Open the application launcher.
  • Search for Info Center or About System.
  • Open it to view detailed system info, including Linux version.

Other Desktop Environments

Most modern Linux desktops have a system info or about section in their settings. Look for keywords like “About,” “System Info,” or “Details.”

How to Check Version on Different Linux Distributions

Different distros may have slight variations in how they store version info. Here’s a quick guide for popular distros.

DistributionCommand/File to Check Version
Ubuntulsb_release -a, /etc/os-release
Debianlsb_release -a, /etc/debian_version
Fedoralsb_release -a, /etc/fedora-release
CentOS/etc/centos-release, cat /etc/redhat-release
Red Hat/etc/redhat-release
Arch Linux/etc/os-release, lsb_release -a

For example, on CentOS, you can run:

cat /etc/centos-release

This will show the CentOS version directly.

Tips for Checking Linux Version Remotely

If you manage servers remotely, you can check the Linux version via SSH.

  • Connect to the server:

    ssh user@server_ip
    
  • Run any of the commands above, like:

    lsb_release -a
    

or

  cat /etc/os-release

This helps you quickly identify the system without physical access.

Troubleshooting Common Issues

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

  • Command not found: Install missing packages like lsb-release.
  • File not found: Try alternative files like /etc/redhat-release or /etc/issue.
  • Permission denied: Use sudo if necessary, though most version files are readable by all users.
  • No output: Ensure you are on a Linux system, not another Unix variant.

Summary Table of Commands to Check Linux Version

CommandPurposeNotes
lsb_release -aDetailed distro infoMay require installation
cat /etc/os-releaseStandard distro info fileAvailable on most distros
hostnamectlSystem and OS infoShows kernel and hostname too
uname -rKernel version onlyUseful for kernel-specific info
cat /etc/*-releaseDistro-specific release filesVaries by distro

Conclusion

Now you know several simple ways to check your Linux version. Whether you prefer the command line or a graphical interface, you can quickly find out your distro name, version number, and kernel details. This knowledge helps you manage your system better and ensures compatibility with software and updates.

Next time you need to check your Linux version, just open your terminal and try one of the commands I shared. You’ll get accurate information in seconds. Remember, knowing your Linux version is a small step that makes a big difference in managing your system effectively.


FAQs

How do I check my Linux kernel version?

Use the command uname -r in the terminal. It shows the kernel version, which is important for hardware support and system updates.

What is the difference between distro version and kernel version?

The distro version refers to the Linux distribution release (like Ubuntu 22.04), while the kernel version is the core Linux system (like 5.15.0). Both are important but serve different purposes.

Can I check Linux version without terminal?

Yes, most Linux desktops have a system info or “About” section in settings where you can see your Linux version graphically.

What if lsb_release command is not available?

You can install it using your package manager, for example, sudo apt install lsb-release on Ubuntu or check /etc/os-release file instead.

How to check Linux version on a remote server?

Connect via SSH and run commands like lsb_release -a or cat /etc/os-release to get version details remotely.

More from this blog

L

LinuxBloke | Linux Tips, Tricks & Troubleshooting

672 posts