Programming

How to Check Ubuntu Version in Linux Command Line

A setup guide tells you to "use Ubuntu 22.04 or later." Your server says Ubuntu, but not which one. Run the wrong install steps on the wrong release and a package won't be found, a repository will fail, or you will keep running a system that no longer gets security fixes.

Linux administrator typing a command in a terminal to check the Ubuntu version.

This guide shows how to check your Ubuntu version from the terminal and from the desktop. It also gives the release names, the support end dates for 2026, and the command that tells you whether your machine is still receiving security patches.

Quick answer: Run lsb_release -a to see your Ubuntu version and codename. If that command isn’t installed, run cat /etc/os-release, which works on every normal Ubuntu install, including containers and WSL. On the desktop, open Settings, then System, then About.

Which Command Should You Use?

Use lsb_release -a for a readable answer and /etc/os-release when you need a command that always works. Use hostnamectl when you also want the kernel and architecture. Each method below reads the same release information in a different way.

MethodCommandBest for
lsb_releaselsb_release -aA readable answer in an interactive terminal
Short lsb_releaselsb_release -rs or lsb_release -csScripts that need only the number or codename
os-releasecat /etc/os-releaseMinimal installs, containers, SSH sessions and WSL
hostnamectlhostnamectlVersion plus kernel, architecture and virtualization
/etc/issuecat /etc/issueA quick look at the login banner text
FastfetchfastfetchA full system summary on the desktop
SettingsSettings > System > AboutDesktop users who prefer a window

Method 1: Use the lsb_release Command

The lsb_release command prints your Ubuntu release number and codename in a readable form. Open a terminal with Ctrl + Alt + T and run:

lsb_release -a

The output looks like this, with your own release in place of the example:

Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:        24.04
Codename:       noble

Here is what each line means:

  • Distributor ID: The distribution name, which is Ubuntu.
  • Description: The full release name, including whether it is an LTS (Long-Term Support) release.
  • Release: The version number, such as 24.04.
  • Codename: The release’s code name, such as noble.

For scripts, two short forms print only one value:

lsb_release -rs
lsb_release -cs

The first prints the version number, such as 26.04. The second prints the codename, such as resolute.

On some 22.04 systems, lsb_release -a first prints “No LSB modules are available.” The release details after that line are still correct, so you can ignore it.

If you see lsb_release: command not found, the package is missing, which is common on minimal and server images. Install it with sudo apt install lsb-release, or use Method 2 instead.

Method 2: Read the /etc/os-release File

The /etc/os-release file is present on every normal Ubuntu install, so it is the safest fallback. It is also the right choice inside containers, over SSH and in WSL, where lsb_release is often missing. Run:

cat /etc/os-release

You will see several lines. These are the ones that matter:

  • NAME: The distribution name, Ubuntu.
  • VERSION: The version with its label, such as 24.04 LTS (Noble Numbat).
  • VERSION_ID: The clean version number, such as 24.04.
  • VERSION_CODENAME: The codename, such as noble.

To print just the two fields most scripts need, use grep:

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

On Ubuntu 26.04 this prints VERSION_ID="26.04" and VERSION_CODENAME=resolute.

Method 3: Run hostnamectl

The hostnamectl command shows your Ubuntu version along with the kernel, architecture and virtualization type. It is usually used to view or set the hostname, but its output works well as a system summary. Run:

hostnamectl

Find the line labeled Operating System. It reads something like “Ubuntu 26.04 LTS”. The kernel and virtualization lines can change after an update or when the host environment changes, so use this method for context and not for scripts.

If you manage software rollouts across many machines, a tool such as distribution management software can help you track and roll out updates once you know which release each one runs.

Method 4: Look at the /etc/issue File

The /etc/issue file holds the text shown before the login prompt. It also names your release. Run:

cat /etc/issue

You will see a line such as Ubuntu 24.04 LTS \n \l. The \n and \l are placeholders that the login screen fills in, so ignore them. This file is short and doesn’t show the codename, so use it only as a quick check. A system administrator can also edit the banner, so trust /etc/os-release if the two disagree.

Method 5: Use Fastfetch

Fastfetch prints your Ubuntu version next to a logo, with the kernel, shell, CPU and memory. It replaces Neofetch, which was the usual answer in older guides. The Neofetch repository was archived in 2024 and had not been updated since August 2020, so new installs should use Fastfetch.

On Ubuntu 26.04, Fastfetch is in the official Universe repository:

sudo apt update
sudo apt install fastfetch

On Ubuntu 24.04, the stock archive can lag behind, so a common route is the maintainer’s PPA:

sudo add-apt-repository ppa:zhangsongcui3371/fastfetch
sudo apt update
sudo apt install fastfetch

Then run fastfetch. On minimal or server installs, add-apt-repository may be missing. Install software-properties-common first.

Method 6: Check the Version From the Desktop

On the desktop, open Settings, choose System, then About. The window shows your Ubuntu release name and version, and often the hardware and GNOME details too. This is the easiest way if you don’t use the terminal. It only works on a desktop install, not on a server or a remote shell.

Ubuntu Versions, Codenames and Support Dates

Every Ubuntu release has a version number and a codename, and each one has a date when security updates stop. LTS releases get five years of standard security maintenance. Interim releases get about nine months.

VersionCodenameTypeReleasedStandard security endsUbuntu Pro ends
20.04focalLTSApr 2020May 2025May 2030
22.04jammyLTSApr 2022May 2027May 2032
24.04nobleLTSApr 2024May 2029May 2034
26.04resoluteLTSApr 2026May 2031May 2036
26.10Stonking StingrayInterimOct 2026Jul 2027Not available

Ubuntu 20.04 is past standard support. Only a paid Ubuntu Pro subscription extends its security coverage. Ubuntu Pro is free for personal use on up to five machines. Interim releases like 26.10 are released every six months and can’t use Pro.

Pick LTS for servers and any machine you don’t want to upgrade often. Pick an interim release only if you want newer software and are happy to upgrade every six months.

Is Your Ubuntu Version Still Supported?

Check your release against the table above, then ask the machine itself. The pro security-status command from Canonical’s Ubuntu Pro client summarizes your installed packages and the security coverage that applies to them:

pro security-status

The output groups packages by source (main and restricted, universe and multiverse, third-party, and no longer available). It tells you the year your LTS coverage ends. If the LTS period has ended, it says so with a message like “This machine is NOT receiving security patches because the LTS period has ended.” If your apt cache is stale, it will tell you to run sudo apt update first.

Useful flags:

  • pro security-status --thirdparty lists packages from third-party sources such as PPAs.
  • pro security-status --unavailable lists installed packages with no current download source.
  • pro security-status --esm-apps shows coverage details for universe and multiverse packages.

Interim releases can’t use Pro, but the output still shows package counts and a support end date nine months after release.

Kernel Version vs Ubuntu Version

Your Ubuntu version and your Linux kernel version are different numbers. The Ubuntu version, such as 26.04, names the release. The kernel version names the core of the operating system. They update on different schedules. To see the kernel, run:

uname -r

hostnamectl also shows the kernel. When a guide asks for your version, it almost always means the Ubuntu release number, not the kernel.

Check the Ubuntu Version on WSL, Docker, SSH and Cloud Servers

The same commands work almost everywhere, but a few places need care.

WhereWhat to do
SSH into a serverRun any command above in the remote shell
WSL on WindowsRun lsb_release -a or cat /etc/os-release inside the Ubuntu shell. They report the Ubuntu release, not your Windows version
Docker containerRun cat /etc/os-release. The lsb_release tool is often missing from minimal images
Cloud server or VMUse cat /etc/os-release first, then hostnamectl for the virtualization type

If you are choosing a platform for virtual machines, see our guide to server virtualization software for a VMware replacement. If you connect to servers remotely, read why businesses need secure remote access.

Should You Upgrade After You Check?

Upgrade if your release is out of standard support or you need newer packages. Ubuntu’s server documentation says you can upgrade only from one LTS to the next LTS, and you can’t skip releases. LTS-to-LTS upgrades are offered after the first point release, such as 20.04.1.

Before you upgrade:

  1. Back up your data.
  2. Run sudo apt update, then sudo apt dist-upgrade, and confirm no updates remain.
  3. Reboot if the file /run/reboot-required exists.
  4. Free enough disk space, because downloads can be several gigabytes.
  5. Expect third-party repositories and PPAs to be disabled during the upgrade. They are the most common cause of problems.

Then run sudo do-release-upgrade. The system isn’t considered upgraded until you reboot, so reboot and check your version again.

Fix Common Version-Check Problems

Most problems come from a missing package or a machine that hasn’t rebooted. Use this table.

ProblemFix
lsb_release: command not foundRun cat /etc/os-release, or install it with sudo apt install lsb-release
“No LSB modules are available”Ignore it. The release details below it are correct
Version still shows the old release after an upgradeReboot, then check again
add-apt-repository: command not foundInstall software-properties-common, then retry
/etc/issue shows a different version than /etc/os-releaseTrust /etc/os-release. The banner may have been edited
Output says “LTS” but you don’t know the point releaseRead the full Description line from lsb_release -a

Once you know your release, you can pick the right install steps. For example, our guides on installing Composer for Laravel, installing Laravel and running DeepSeek R1 locally all depend on a compatible release. If you plan to edit config files in the terminal, Vim commands are worth learning, and after installing Laravel you can check the Laravel version the same way.

FAQ

How do I check my Ubuntu version in the terminal?

Run lsb_release -a. It prints the distributor, description, release number and codename. If the command isn’t installed, run cat /etc/os-release instead.

What is the fastest command to check the Ubuntu version?

Use lsb_release -rs for just the number, such as 26.04. It prints a single value, which suits scripts and quick checks.

How do I check the Ubuntu version without the terminal?

Open Settings, choose System, then About. The window shows your release name and version. This works on desktop installs only.

How do I check the Ubuntu version on a server over SSH?

Connect with SSH and run cat /etc/os-release or lsb_release -a in the remote shell. They return the remote server’s version, not your local machine’s.

What is the difference between the Ubuntu version and the kernel version?

The Ubuntu version, such as 24.04, names the release. The kernel version, shown by uname -r, names the Linux kernel. They change on different schedules.

How do I know if my Ubuntu version is still supported?

Compare it to the support table above, then run pro security-status. It states how long LTS coverage lasts or warns that the LTS period has ended and security patches have stopped.

What does LTS mean in Ubuntu?

LTS means Long-Term Support. An LTS release is published every two years and gets five years of standard security maintenance. Ubuntu Pro adds ten more years of expanded security coverage.

Why does lsb_release say “command not found”?

The lsb-release package isn’t installed, which is common on minimal and server images. Install it with sudo apt install lsb-release, or read /etc/os-release.

Does the same command work on WSL and Docker?

Yes, but use cat /etc/os-release in Docker, because lsb_release is often missing from minimal images. On WSL, the commands report the Ubuntu release inside WSL, not the Windows version.

Know Your Release Before You Change Anything

Checking your Ubuntu version takes one command, and it saves you from installing the wrong packages or running a system that no longer gets security fixes. Start with lsb_release -a, fall back to cat /etc/os-release, and run pro security-status to see whether your release is still covered.

If your release has passed its end date, plan the upgrade now. Which release are you on today: an LTS you can keep for years, or an older one that needs a move?

Leave a Reply

Your email address will not be published. Required fields are marked *

Share the article

Written By

Author Avatar

October 23, 2026

Hi there! I’m Ayesha Khan, a skilled content writer with a strong background in computer science. I specialize in transforming complex ideas into clear, engaging, and easy-to-understand content. With 10 years of experience working across different industries, I focus on delivering content that not only informs but also connects with readers. I’m passionate about writing and take pride in creating high-quality work that helps clients communicate their message effectively.