How To Find Os Version In Linux – Linux OS Version Check Commands

Your Linux OS version appears at the top of the terminal when you run cat /etc/os-release. But if you’re new to Linux, figuring out how to find os version in linux can feel a bit confusing at first. Don’t worry—this guide covers every method, from simple commands to checking GUI settings, so you’ll always know exactly what system you’re running.

Whether you’re troubleshooting software, installing packages, or just curious, knowing your OS version is a basic but essential skill. Let’s jump right in.

How To Find Os Version In Linux

The quickest way to check your Linux version is through the terminal. Most modern distributions store version info in a few standard files. Here’s how to use them.

Using The Cat Command With Os-Release

Open your terminal and type:

cat /etc/os-release

This command displays details like the OS name, version ID, and pretty name. It works on Ubuntu, Debian, Fedora, Arch, and almost every major distro. The output looks something like this:

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

If the file is missing on your system, try cat /etc/lsb-release instead. That file is common on older Ubuntu versions.

Using The Hostnamectl Command

Another fast method is hostnamectl. This command is part of systemd, so it works on most modern Linux systems. Just run:

hostnamectl

The output includes the operating system and kernel version. For example:

   Static hostname: my-pc
         Icon name: computer-vm
           Chassis: vm
        Machine ID: abc123...
           Boot ID: def456...
    Operating System: Ubuntu 22.04.3 LTS
              Kernel: Linux 5.15.0-91-generic
        Architecture: x86-64

This command is especially useful because it shows both the OS version and kernel version in one place.

Checking The Lsb-Release Command

If you have the lsb-release package installed, you can use:

lsb_release -a

This prints all LSB (Linux Standard Base) information. Typical output:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

If the command isn’t found, install it with your package manager. On Debian/Ubuntu: sudo apt install lsb-release.

Using The Uname Command For Kernel Version

Sometimes you only need the kernel version. The uname command is perfect for that. Run:

uname -r

This returns something like 5.15.0-91-generic. For more detail, use uname -a to see all system info:

Linux my-pc 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Note that the kernel version isn’t the same as the OS version. The OS version is the distribution release (like Ubuntu 22.04), while the kernel is the core system software.

Checking The Etc Issue File

Another quick trick is to look at /etc/issue. This file often contains a simple text banner with the OS name and version. Type:

cat /etc/issue

Output might be:

Ubuntu 22.04.3 LTS \n \l

This method isn’t always reliable because some distros customize this file. But it’s worth a try.

Using The Neofetch Or Screenfetch Tools

For a more visual approach, you can install tools like neofetch or screenfetch. These display system info along with an ASCII logo of your distro. Install them first:

  • On Debian/Ubuntu: sudo apt install neofetch
  • On Fedora: sudo dnf install neofetch
  • On Arch: sudo pacman -S neofetch

Then just run neofetch. The output includes the OS version, kernel, uptime, and more. It’s a favorite among Linux enthusiasts for sharing system specs in forums.

Finding The Os Version In Gui

If you prefer a graphical interface, most desktop environments show the OS version in system settings. Here’s where to look:

  • GNOME: Open Settings → About. Look for “OS Name” or “Device Name”.
  • KDE Plasma: Open System Settings → About This System.
  • XFCE: Open Settings Manager → About.
  • Cinnamon: Open System Settings → System Info.

In many cases, the version is also displayed on the login screen or in the system monitor.

Using The Dmesg Command

For advanced users, dmesg shows kernel ring buffer messages, which include the OS version at boot. Run:

dmesg | grep -i "linux version"

This returns a line like:

[    0.000000] Linux version 5.15.0-91-generic (buildd@lgw01-amd64-051) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023

This method is more technical but gives you the exact build details.

Checking The Proc Version File

The /proc/version file also contains kernel and OS info. Type:

cat /proc/version

Output example:

Linux version 5.15.0-91-generic (buildd@lgw01-amd64-051) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023

This is similar to uname -a but in a different format.

Using The Apt Or Dnf Package Manager

On Debian-based systems, you can check the OS version via the package manager. Run:

apt --version

While this shows the APT version, it doesn’t directly give the OS version. However, you can infer it from the repository sources. For example, if you see jammy in your sources list, you’re on Ubuntu 22.04.

On Fedora, use:

dnf --version

Again, this is more about the tool than the OS.

Checking The Os Version In Docker Containers

If you’re inside a Docker container, the same commands work. Just run cat /etc/os-release or hostnamectl (if systemd is available). Some minimal containers may not have these files, so you might need to install lsb-release first.

Using The Getconf Command

The getconf command can show system variables, including the OS version. Try:

getconf GNU_LIBC_VERSION

This shows the glibc version, which can hint at the OS age. But it’s not a direct OS version check.

Checking The Os Version In Wsl

If you’re using Windows Subsystem for Linux (WSL), the same Linux commands work. Open your WSL terminal and run cat /etc/os-release. The output will show the distro version you installed (e.g., Ubuntu 22.04).

Using The Python Platform Module

For scripters, Python can retrieve the OS version. Run:

python3 -c "import platform; print(platform.platform())"

This returns something like Linux-5.15.0-91-generic-x86_64-with-glibc2.35. You can also use platform.linux_distribution() on older Python versions.

Common Pitfalls And Troubleshooting

Sometimes the commands above don’t work as expected. Here are a few issues and fixes:

  • File not found: If /etc/os-release is missing, try /etc/lsb-release or /etc/redhat-release for Red Hat-based systems.
  • Command not found: If lsb_release isn’t available, install it with your package manager.
  • Minimal installs: Some server installs lack graphical tools or extra packages. Stick to terminal commands.
  • Virtual machines: The OS version inside a VM is independent of the host. Use the same commands inside the VM.

Why Knowing Your Os Version Matters

Knowing your OS version helps with:

  • Installing software that requires specific versions
  • Troubleshooting compatibility issues
  • Applying security patches
  • Following tutorials that target a particular distro
  • Understanding your system’s lifecycle (e.g., when support ends)

For example, Ubuntu 22.04 LTS is supported until 2027, while Ubuntu 23.10 has only 9 months of support. Checking your version helps you plan upgrades.

Automating Os Version Checks

If you manage multiple servers, you can automate version checks with a script. Here’s a simple bash script:

#!/bin/bash
for server in server1 server2 server3; do
    ssh $server "cat /etc/os-release | grep -E '^(NAME|VERSION)='"
done

This prints the name and version of each remote server. You can also use tools like Ansible or Puppet for larger fleets.

Understanding Different Version Formats

Linux distributions use different versioning schemes. For example:

  • Ubuntu: Uses year.month format (e.g., 22.04). LTS versions have long-term support.
  • Fedora: Uses sequential numbers (e.g., 39). New releases every 6 months.
  • Debian: Uses codenames (e.g., Bullseye, Bookworm) with version numbers (e.g., 11, 12).
  • Arch Linux: Rolling release, so no version number. You check the kernel version instead.
  • CentOS/RHEL: Uses major.minor format (e.g., 7.9, 8.5).

Knowing the format helps you interpret the output correctly.

Using The Os Version In Scripts

You can use the OS version in scripts to conditionally run commands. For example:

if grep -q "Ubuntu 22.04" /etc/os-release; then
    echo "Running Ubuntu 22.04"
else
    echo "Different OS"
fi

This is useful for deployment scripts that need to handle different distributions.

Checking The Os Version Without Terminal

If you’re on a system without terminal access (like a cloud console), you might still see the version in the login banner. Many VPS providers show the OS version when you SSH in. Also, the /etc/motd file often contains version info.

Frequently Asked Questions

Q: What is the easiest command to find the OS version?
A: The easiest is cat /etc/os-release. It works on almost all modern Linux distributions.

Q: How do I find the OS version in Linux without using the terminal?
A: Open your system settings. In GNOME, go to Settings → About. In KDE, go to System Settings → About This System.

Q: Why does uname -r show a different version than cat /etc/os-release?
A: uname -r shows the kernel version, while cat /etc/os-release shows the distribution version. They are different.

Q: Can I find the OS version in a Docker container?
A: Yes, use the same commands inside the container. If the container is minimal, you may need to install lsb-release first.

Q: What if none of these commands work?
A: Try cat /etc/*release to list all release files. Also check cat /etc/issue or hostnamectl. If still nothing, your system might be very minimal or custom.

Summary Of Commands

Here’s a quick reference table:

Command What It Shows
cat /etc/os-release OS name, version, ID
hostnamectl OS and kernel version
lsb_release -a LSB details
uname -r Kernel version
cat /etc/issue Simple OS banner
neofetch Visual system info

Bookmark this page for quick reference. Over time, you’ll memorize your favorite method.

Final Tips

Always double-check your version before installing software or following guides. Some tutorials assume a specific version, and using the wrong one can cause errors. If you’re on a rolling release like Arch, focus on the kernel version and package updates rather than a static version number.

Practice these commands on your system. Try each one and see the output. You’ll soon be able to identify any Linux system at a glance.

Now you know exactly how to find os version in linux. Whether you use the terminal or GUI, you have all the tools you need. Happy Linux-ing!