How to Check Ubuntu Version on Ubuntu 26.04, 24.04 and 22.04

Check Ubuntu version on Ubuntu 26.04, 24.04 and 22.04 from the terminal or Settings on desktop, server, and WSL. Covers lsb_release, /etc/os-release, and hostnamectl.

Last updatedAuthorJoshua JamesRead time4 minGuide typeUbuntu

Package guides, release upgrades, and repository instructions are easier to follow when you know both the Ubuntu version number and codename. To check Ubuntu version from the terminal, start with lsb_release -a; for minimal systems or scripts, read /etc/os-release because it exists even when helper commands are missing.

The same checks apply to Ubuntu 26.04, 24.04, and 22.04 on Desktop, Server, cloud VMs, and WSL. None of the read-only version checks require sudo; only the graphical Settings path requires a desktop session.

Check Ubuntu Version in the Terminal with lsb_release

For most interactive Ubuntu sessions, the main Ubuntu version command is lsb_release -a. It prints the release number and codename in one readable block.

lsb_release -a

Relevant output on Ubuntu 26.04 includes:

Release:	26.04
Codename:	resolute

Use the Release line for the numbered Ubuntu version and the Codename line for repository names such as resolute, noble, or jammy.

Print Only the Ubuntu Version Number or Codename

If a repository command, support page, or script only needs the release number or codename, add -s to suppress labels:

lsb_release -rs
lsb_release -cs
26.04
resolute

On Ubuntu 24.04, the same commands print 24.04 and noble. On Ubuntu 22.04, lsb_release -cs prints jammy.

Check Ubuntu Version from /etc/os-release

The /etc/os-release file is present on every normal Ubuntu install, which makes it especially useful on stripped-down server images, cloud instances, containers, and Ubuntu on WSL. Use grep to print the fields most package guides need:

grep -E '^(VERSION_ID|VERSION_CODENAME)=' /etc/os-release
VERSION_ID="26.04"
VERSION_CODENAME=resolute

This is the most reliable copy-and-paste option when you only need exact release fields for a repository, support matrix, or script. If you want the full operating system record instead, run cat /etc/os-release. For more filtering patterns, see the grep command guide.

Check Ubuntu Version with hostnamectl

Use hostnamectl when you want more than the Ubuntu release. It shows the operating system, kernel, architecture, and virtualization details in one command, which is handy on workstations, virtual machines, and remote servers.

hostnamectl

For Ubuntu version checks, the important line is:

Operating System: Ubuntu 26.04 LTS

Other hostnamectl lines show the kernel, architecture, and virtualization state, but those values can change with updates or the host environment. On WSL, prefer lsb_release or /etc/os-release because they report the Ubuntu user space directly and with less host-side noise.

Check Ubuntu Version on WSL and Ubuntu Server

The same Ubuntu commands work across desktop installs, headless servers, and WSL sessions. The main difference is where you run them.

Check Ubuntu Version in WSL

Open the Ubuntu shell itself, then run lsb_release -a or read /etc/os-release there. Those commands report the Ubuntu release inside WSL, not the Windows host version. PowerShell’s wsl -l -v command can show registered distributions and whether they use WSL 1 or WSL 2, but the Ubuntu release number still comes from inside the Ubuntu environment.

Check Ubuntu Version on a Headless Server or Cloud VM

Once you are logged in over SSH, the commands stay the same. On lean server images, /etc/os-release is usually the safest first check because it is always available and does not depend on extra helper packages. After you confirm the release, keep the system current with our guide to update packages via Ubuntu command line or automate security patches with configure unattended upgrades on Ubuntu.

Check Ubuntu Version from the Desktop Settings App

If you are already in a graphical Ubuntu Desktop session, the Settings app can confirm the release without opening a terminal.

  1. Open Settings.
  2. Select System in the sidebar.
  3. Open About.
  4. Read the Ubuntu release shown in the operating system details.
Ubuntu Settings About page showing where the operating system release appears
Example Ubuntu Settings About page showing where the installed release appears.

This path is desktop-only. It does not apply to headless Ubuntu Server installs, most cloud images, or standard terminal-only WSL sessions.

Choose the Right Ubuntu Version Check Method

Each method answers a slightly different need. Pick the one that matches the environment you are checking.

MethodBest ForWhat It ShowsEnvironment Fit
lsb_release -aReadable terminal output on most Ubuntu systemsRelease, codename, and descriptive release nameDesktop, server, and WSL when the utility is installed
grep -E '^(VERSION_ID|VERSION_CODENAME)=' /etc/os-releaseMinimal images, scripts, SSH sessions, and WSLExact release number and codename fieldsBest all-around fallback for server and WSL
hostnamectlSystem summaries and troubleshootingOperating system, kernel, architecture, and virtualizationFull desktop or server installs with systemd
Settings > System > AboutDesktop users who prefer a graphical pathUbuntu release in the Settings appDesktop only

Troubleshoot Ubuntu Version Checks

lsb_release Command Is Missing

Minimal containers and stripped images may not include lsb_release. If the shell says the command is not found, use /etc/os-release instead because it is part of the base operating system metadata.

lsb_release: command not found
grep -E '^(VERSION_ID|VERSION_CODENAME)=' /etc/os-release
VERSION_ID="26.04"
VERSION_CODENAME=resolute

No LSB Modules Are Available

Some Ubuntu 22.04 systems print this informational line alongside the normal lsb_release -a output:

No LSB modules are available.

The release data after that line is still correct. Read the Release and Codename lines, or switch to /etc/os-release for cleaner script-friendly output.

hostnamectl Shows Extra Host Details

WSL, containers, and virtual machines can add kernel, host, or virtualization details that are not the Ubuntu release you need. Use lsb_release or /etc/os-release when the goal is only the Ubuntu user-space version.

Conclusion

Once you know the Ubuntu release and codename, package instructions, repository names, and upgrade paths are easier to verify. Use that information before installing release-specific packages, planning upgrades, or setting routine update automation for the machine.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: