How To Find Ubuntu Version

How To Find Ubuntu Version

Reading time1 min
#Linux#Ubuntu#Sysadmin#UbuntuVersion#LinuxCommands#SystemInfo

Mastering System Transparency: How to Accurately Identify Your Ubuntu Version

When managing a Linux system, knowing exactly which Ubuntu version you’re running isn’t just a trivial detail—it’s a foundational piece of information that guides troubleshooting, software compatibility decisions, and security patch management. Yet, many users fall into the trap of guessing or relying on incomplete methods to check their Ubuntu release, potentially leading to misconfigurations or vulnerabilities.

Forget the guesswork and myths around checking your Ubuntu version—this guide unlocks simple, definitive commands and file checks that reveal your system details with surgical precision. Follow along and save yourself hours of confusion!


Why Knowing Your Ubuntu Version Matters

Before diving into the how-to, it’s good to understand why this matters:

  • Troubleshooting: Many support resources and bug fixes are version-specific.
  • Compatibility Checks: Certain software versions require a minimum (or specific) Ubuntu release.
  • Security Updates: Applying the right security patches hinges on knowing your exact OS baseline.

With that in mind, let’s get precise.


1. Check /etc/os-release – Your Go-To Source File

Ubuntu stores detailed version info in the /etc/os-release file, which is readable by anyone.

Run this command:

cat /etc/os-release

Example output:

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"
HOME_URL="https://www.ubuntu.com/"

What this tells you:

  • The full version is “22.04.2 LTS”
  • The codename is “Jammy Jellyfish”
  • It confirms your system ID as Ubuntu

This method is reliable because the file is updated with each release and contains human-readable info.


2. The lsb_release Command – Clean & Concise Output

If you want a brief yet precise version summary, lsb_release is what you want.

Run:

lsb_release -a

Sample output:

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

Here you get exactly what you need — Distributor ID, Release number, codename — all neatly presented.

Note: If lsb_release isn’t installed (rare), you can install it:

sudo apt update && sudo apt install lsb-release

3. Use hostnamectl for Modern Systems

On newer versions of Ubuntu (with systemd), hostnamectl provides OS info alongside host details.

Run:

hostnamectl

Example relevant part of output:

Operating System: Ubuntu 22.04.2 LTS
Kernel: Linux 5.15.0-56-generic
Architecture: x86-64

It’s quick and informative if you’re already using commands related to systemd.


4. Less Recommended: Reading /etc/issue or /etc/lsb-release

These files exist but aren’t always reliable or consistent across all flavors and versions:

cat /etc/issue
cat /etc/lsb-release

They may give partial info but often don’t include minor point releases or can be customized/empty.


Bonus Tip: Print Just the Version Number Only

If you want a neat one-liner showing only the major release number (for scripting or conditional logic), do:

lsb_release -rs
# Or parse /etc/os-release:
grep VERSION_ID /etc/os-release | cut -d '"' -f2

Example output:

22.04

This is perfect for scripts where you need just the version number without fluff.


Summary Cheat Sheet

CommandWhat You GetNotes
cat /etc/os-releaseFull OS detailsVery reliable
lsb_release -aDetailed release summaryClean & user-friendly
hostnamectlOS + host infoUseful on newer distros
cat /etc/issueSimple stringSometimes outdated
cat /etc/lsb-releaseBasic distro infoMay be missing or minimal

Wrapping Up

Accurately identifying your Ubuntu version shouldn’t be a guessing game or a series of trial-and-error hacks—you just need to know where to look and what commands to run.

By mastering these quick techniques, you’ll confidently grasp your system’s identity—empowering smarter troubleshooting, flawless compatibility insights, and precise security management.

Next time anyone asks “Which Ubuntu version are you running?” instead of shrugging or Googling endlessly, you'll have your answer in seconds.

Happy sysadmin-ing!