3v-Hosting Blog

How to Check Your Linux Version

Administration

7 min read


It is crucial to understand which version of Linux you are running. This is essential for troubleshooting, software installation and system maintenance. Linux is a diverse ecosystem composed of many distributions (distros), such as Ubuntu, Debian, CentOS, Fedora, Arch Linux, and more. This is in stark contrast to commercial operating systems that follow a single development path. Each of these distros will ship with a different package manager, release cycle, system utilities and default kernel. Version numbers in the same distribution can indicate critical differences in system behaviour, support timelines, or available software.

Ubuntu 20.04 and 22.04 are both Long Term Support (LTS) releases, but each comes with a different default Linux kernel and userland features. It is crucial to identify your version precisely-both the OS release and the kernel version. Manage your desktop, remote VPS or fleet of production servers with confidence by keeping full visibility of your Linux version. This is the key to making informed technical decisions.

This article will tell you exactly how to check both the Linux distribution and the underlying kernel version using reliable, built-in tools available on most systems. We will provide you with the knowledge to work across different environments, including desktop installations, headless servers, cloud instances, and containers.

 

 

 

Why It’s Important to Know Your Linux Version

 

When you install software, apply security patches or seek help online, you'll often be asked: Tell me what Linux I'm running and what kernel version is installed. These are not just routine questions-they are essential for ensuring compatibility and proper system behaviour. Some software packages require specific library versions or kernel modules, and many system guides are tailored to particular distributions or versions.

Know your Linux version. This is the key to preventing the installation of incompatible software and following the correct set of instructions. You can accurately describe your environment when searching for help in forums or submitting bug reports. For instance, a problem that occurs on Fedora 40 with kernel 6.4 may not exist on Debian 12 with kernel 5.10. Without this knowledge, troubleshooting becomes guesswork.

Furthermore, system administrators and DevOps professionals frequently use automated scripts that behave differently based on the detected OS and kernel. These scripts apply different configuration files, install different packages, or enable specific features depending on the version. Performing a Linux version check is not just for beginners. It is a best practice that helps maintain consistency, security and operational clarity across diverse systems.

 

 

 

 

How to Check Your Distribution Version

 

There are several methods to find out the name and version of your Linux distribution.


View /etc/os-release


The most universal way is reading the /etc/os-release file:

    cat /etc/os-release

This shows values like NAME, VERSION, and PRETTY_NAME, such as:

    PRETTY_NAME="Ubuntu 22.04.3 LTS"

 

Use hostnamectl (on systemd-based systems)

Run:

    hostnamectl

This displays details such as:

    Operating System: Ubuntu 22.04.3 LTS
    Kernel: Linux 6.2.0-26-generic

 

Use lsb_release (on Debian-based distros)

Run:

    lsb_release -a

This returns output like:

    Distributor ID: Ubuntu
    Release: 22.04
    Codename: jammy

 

Other distro-specific files

On Red Hat-based systems, try:

    cat /etc/redhat-release

On Debian-based systems, you can also use:

    cat /etc/debian_version

These methods will help you see Linux version accurately, regardless of which distribution you’re using.

 


 

Other articles on administration in our Blog:


    - How to Use NsLookup Commands in Windows and Linux

    - 10 most frequently used examples for IPTABLES

    - 10 useful console utilities for monitoring a Linux server

    - How to remotely connect to MySQL

 


 

 

How to Check the Linux Kernel Version

 

To get the version of the Linux kernel (the core of the OS), use the following commands:

    uname -r - This is the quickest way to check Linux kernel version
    uname -a - Shows more detailed system info
    cat /proc/version - An alternative low-level way to check kernel version Linux
    rpm or dpkg - to check installed kernel packages

        On Debian-based systems:

            dpkg -l | grep linux-image

        On Red Hat-based systems:

            rpm -q kernel

        Note that uname -r shows the running kernel, while the package managers list all installed kernels.

 

 

 

 

How to Automate Version Detection

 

You can include version checks in scripts. For example:

    #!/bin/bash

    # Check distribution
    if [ -f /etc/os-release ]; then
        . /etc/os-release
        echo "Distribution: $PRETTY_NAME"
    fi

    # Check kernel
    echo "Kernel version: $(uname -r)"

This is useful for automated setups, deployment scripts, and diagnostic tools.

 

 

 

 

If Commands Don’t Work

 

Some minimal systems, like Docker containers or Alpine Linux, may lack common tools like lsb_release. In that case:

    - Use uname -r and cat /etc/*release
    - Explore /proc/version if standard tools are unavailable
    - Install missing utilities (e.g., lsb-release) if possible

In containerized environments, remember that the container shares the kernel with the host. So if you linux check kernel version from within a container, it shows the host’s kernel, not an isolated one.

 

 

 

 

Final Thoughts

If you’ve ever wondered “what version of Linux am I running”, you now have multiple answers depending on your needs. Whether you want to know your distribution, perform a Linux version check, or show the kernel version, the tools built into every Linux system give you all the necessary information.

Most users will find /etc/os-release and uname -r sufficient. But if you're managing systems, writing scripts, or debugging complex setups, it's useful to know all available methods to explore Linux version details from multiple angles.