How to Check Ubuntu Version: Command Line, GUI, Server & WSL

Tech reviewed: Deepak Prasad
How to Check Ubuntu Version: Command Line, GUI, Server & WSL

To check Ubuntu version from the command line, run:

bash
lsb_release -a

If you only need the Ubuntu version number, run:

bash
lsb_release -rs

If lsb_release is not installed, use:

bash
cat /etc/os-release

These commands answer the common questions: which Ubuntu version am I running, how do I get Ubuntu version, and what is the Ubuntu version command.

You do not need sudo for these checks. They only read OS information that is already available to normal users.


Quick Ubuntu Version Commands

Task Command Best For
Check full Ubuntu version details lsb_release -a Desktop, server, SSH
Get only the Ubuntu version number lsb_release -rs Scripts, quick checks
Show the Ubuntu release name lsb_release -ds Human-readable output
Find Ubuntu codename lsb_release -cs Repository and package setup
Check OS version from a standard file cat /etc/os-release Server, container, WSL
Display pretty OS name only . /etc/os-release && echo "$PRETTY_NAME" Shell scripts
Display version number from os-release . /etc/os-release && echo "$VERSION_ID" Automation
Check Ubuntu version and kernel hostnamectl systemd systems
Show login banner release cat /etc/issue Fast but less detailed
Check Linux kernel version uname -r Kernel only, not Ubuntu release
Check Ubuntu version in GUI Settings > About Desktop users

Ubuntu version and Linux kernel version are not the same. Ubuntu version means values such as 22.04, 24.04, 25.10, or 26.04. Kernel version means values such as 6.8.0-xx-generic or 7.0.0-xx-generic.


Method 1: Check Ubuntu Version with lsb_release

The most common Ubuntu version command is:

bash
lsb_release -a

Tested output on Ubuntu 25.04:

text
Distributor ID: Ubuntu
Description:    Ubuntu 25.04
Release:        25.04
Codename:       plucky

Here is what each field means:

Field Meaning
Distributor ID The Linux distribution, usually Ubuntu
Description Full Ubuntu release name
Release Ubuntu version number
Codename Ubuntu release codename

Use this method when you want the clearest answer for searches like check ubuntu version, ubuntu version check, ubuntu version command, or command to check ubuntu version.


Method 2: Get Only the Ubuntu Version Number

If you only want the Ubuntu version number, use:

bash
lsb_release -rs

Tested output on Ubuntu 25.04:

text
25.04

To get the full release description in one line:

bash
lsb_release -ds

Tested output on Ubuntu 25.04:

text
Ubuntu 25.04

To get the Ubuntu codename:

bash
lsb_release -cs

Tested output on Ubuntu 25.04:

text
plucky

The codename matters when adding repositories because many Ubuntu repository URLs use codenames such as jammy, noble, or resolute.


Method 3: Find Ubuntu Version from os-release

The /etc/os-release file is one of the most reliable ways to detect Ubuntu version because it is available on modern Linux systems even when lsb_release is not installed.

Display the file using the cat command:

bash
cat /etc/os-release

Tested output on Ubuntu 25.04:

text
PRETTY_NAME="Ubuntu 25.04"
NAME="Ubuntu"
VERSION_ID="25.04"
VERSION="25.04 (Plucky Puffin)"
VERSION_CODENAME=plucky
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=plucky
LOGO=ubuntu-logo

The most useful fields are:

Field Use
PRETTY_NAME Best human-readable Ubuntu version
VERSION_ID Version number, for example 25.04
VERSION_CODENAME Codename, for example plucky
ID Distribution ID, usually ubuntu

For a clean one-line output:

bash
. /etc/os-release && echo "$PRETTY_NAME"

For only the version number:

bash
. /etc/os-release && echo "$VERSION_ID"

For only the codename:

bash
. /etc/os-release && echo "$VERSION_CODENAME"

For scripts, prefer ID, VERSION_ID, and VERSION_CODENAME instead of parsing the full PRETTY_NAME string. If /etc/os-release is not available on an unusual system, check /usr/lib/os-release as the fallback.

This method is ideal for queries like get ubuntu version, find ubuntu version, detect ubuntu version, ubuntu get version number, and linux ubuntu version command.


Method 4: Check Ubuntu Version with hostnamectl

On systemd-based Ubuntu systems, hostnamectl shows operating system and kernel details together:

bash
hostnamectl

Output on a normal Ubuntu system looks similar to this:

text
Static hostname: ubuntu-server
Operating System: Ubuntu 25.04
Kernel: Linux 6.14.0-37-generic
Architecture: x86-64

Look for the Operating System line to find the Ubuntu version.

Use hostnamectl when you also want to see hostname, architecture, and kernel information. If you only need the Ubuntu release number, use lsb_release -rs or /etc/os-release instead.

In minimal containers, restricted shells, or environments without access to the systemd bus, hostnamectl may fail. Use cat /etc/os-release in that case.


Method 5: Check Ubuntu Version from lsb-release File

Ubuntu systems often include the /etc/lsb-release file. You can read it directly:

bash
cat /etc/lsb-release

Tested output on Ubuntu 25.04:

text
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=25.04
DISTRIB_CODENAME=plucky
DISTRIB_DESCRIPTION="Ubuntu 25.04"

The key fields are:

Field Meaning
DISTRIB_RELEASE Ubuntu version number
DISTRIB_DESCRIPTION Full Ubuntu release name
DISTRIB_CODENAME Ubuntu codename

If this file does not exist, use /etc/os-release.


Method 6: Check Ubuntu Version with issue File

The /etc/issue file is a quick way to see the Ubuntu release shown before a local login prompt:

bash
cat /etc/issue

Tested output on Ubuntu 25.04:

text
Ubuntu 25.04 \n \l

This is fast, but it is not the best source for scripts or automation. Use /etc/os-release when accuracy and portability matter.


Method 7: Check Ubuntu Version in GUI

If you are using Ubuntu Desktop:

  1. Open Settings.
  2. Select About.
  3. Check the OS Name field.

The About page usually shows the Ubuntu version, GNOME version, windowing system, processor, memory, disk capacity, and OS type.

This method is best for desktop users who search for which Ubuntu version, how to see Ubuntu version, or which version of Ubuntu am I running.


Method 8: Check Ubuntu Version on Server or over SSH

On an Ubuntu server, you usually do not have a graphical interface. Use one of these commands after logging in with SSH:

bash
lsb_release -a

or:

bash
cat /etc/os-release

For a short server-friendly command:

bash
. /etc/os-release && echo "$PRETTY_NAME"

If lsb_release is missing on a minimal server, install it with the apt command:

bash
sudo apt update
sudo apt install lsb-release

You can also skip the install and rely on /etc/os-release, which is usually already present.


Method 9: Check Ubuntu Version in WSL

If you use Ubuntu through Windows Subsystem for Linux, open your Ubuntu terminal and run:

bash
cat /etc/os-release

or:

bash
lsb_release -a

This shows the Ubuntu userspace version installed inside WSL. It does not show your Windows version.

To list installed WSL distributions from Windows PowerShell:

text
wsl -l -v

That command shows WSL distribution names and WSL version, but for the actual Ubuntu release number, check inside Ubuntu with /etc/os-release.


Method 10: Check Ubuntu Version in a Container

Inside an Ubuntu Docker or container image, the most reliable command is:

bash
cat /etc/os-release

For example:

bash
docker run --rm ubuntu:26.04 cat /etc/os-release

Minimal containers may not include lsb_release, hostnamectl, or systemd. That is why /etc/os-release is the best first choice for containers.


Ubuntu Version vs Kernel Version

Many users confuse the Ubuntu OS version with the Linux kernel version. They answer different questions.

Question Command Example
Which Ubuntu version am I running? lsb_release -rs 25.04
What is the Ubuntu release name? lsb_release -ds Ubuntu 25.04
What Linux kernel am I using? uname -r 6.14.0-37-generic
What CPU architecture is this system? uname -m x86_64

To check the kernel version:

bash
uname -r

Tested output:

text
6.14.0-37-generic

To check the CPU architecture:

bash
uname -m

Tested output:

text
x86_64

To check both OS and kernel in one place:

bash
hostnamectl

Do not use uname -r when a guide asks for your Ubuntu version. It only shows the kernel version.


Ubuntu LTS vs Interim Releases

Ubuntu releases are usually available as LTS releases or interim releases.

  • LTS releases are published every two years in April and receive a longer support window.
  • Interim releases are published between LTS releases and are meant for users who want newer software sooner.

Examples:

Ubuntu Version Codename Type
Ubuntu 22.04 LTS Jammy Jellyfish LTS
Ubuntu 24.04 LTS Noble Numbat LTS
Ubuntu 25.10 Questing Quokka Interim
Ubuntu 26.04 LTS Resolute Raccoon LTS

If you are managing production servers, LTS releases are usually the safer choice because they receive longer maintenance and security updates.

You can confirm whether a release is still supported with Ubuntu's official release information. This matters before installing third-party repositories, running upgrades, or following package instructions that target only Ubuntu 22.04, 24.04, or 26.04.


Best Commands for Scripts

For scripts and automation, avoid scraping human-readable text when a machine-readable field exists.

To check whether the system is Ubuntu:

bash
. /etc/os-release && [ "$ID" = "ubuntu" ] && echo "Ubuntu"

To print only the version number:

bash
. /etc/os-release && echo "$VERSION_ID"

To print the repository codename:

bash
. /etc/os-release && echo "$VERSION_CODENAME"

This is more reliable than using grep and cut on lsb_release output because /etc/os-release is designed for OS identification.


Troubleshooting

lsb_release command not found

If the lsb_release command is missing, install it:

bash
sudo apt update
sudo apt install lsb-release

Or use the standard OS release file:

bash
cat /etc/os-release

hostnamectl does not work

hostnamectl depends on systemd. It may not work in minimal containers, some chroot environments, restricted shells, or stripped-down systems.

Use:

bash
cat /etc/os-release

issue file shows less information

That is normal. /etc/issue is a login-banner style file. For reliable Ubuntu version detection, prefer:

bash
lsb_release -a

or:

bash
cat /etc/os-release

I only see the kernel version

If you ran:

bash
uname -r

you checked the Linux kernel, not the Ubuntu release. Run this instead:

bash
lsb_release -ds

Best Command to Check Ubuntu Version

If you want one command to remember, use:

bash
lsb_release -a

If you are writing a script or checking a minimal server/container, use:

bash
. /etc/os-release && echo "$PRETTY_NAME"

If you want only the version number, use:

bash
lsb_release -rs

These commands cover almost every practical situation: desktop, server, SSH, WSL, container, and automation.


Frequently Asked Questions

1. How do I check Ubuntu version from command line?

Run lsb_release -a to show the Ubuntu distributor ID, description, release number, and codename. You can also run cat /etc/os-release on modern Ubuntu systems.

2. What is the command to check Ubuntu version?

The most common command is lsb_release -a. For only the version number, use lsb_release -rs.

3. How do I get only the Ubuntu version number?

Run lsb_release -rs. It prints only the release number, such as 25.04.

4. How do I find the Ubuntu codename?

Run lsb_release -cs or read VERSION_CODENAME from /etc/os-release.

5. How do I know which Ubuntu version I am running in GUI?

Open Settings, select About, and check the OS Name field.

6. How do I check Ubuntu version on a server?

Use lsb_release -a or cat /etc/os-release over SSH. On minimal servers, /etc/os-release is often the safest option.

7. Is uname -r the Ubuntu version?

No. uname -r shows the Linux kernel version. To check Ubuntu version, use lsb_release -a or cat /etc/os-release.

8. How do I check Ubuntu version in WSL?

Open the Ubuntu WSL terminal and run cat /etc/os-release. This shows the Ubuntu release installed inside WSL, not the Windows version.

9. Do I need sudo to check Ubuntu version?

No. Version check commands such as lsb_release -a, cat /etc/os-release, hostnamectl, and uname -r are read-only and do not require sudo.

10. What should I use in a script to detect Ubuntu version?

Source /etc/os-release and read VERSION_ID, VERSION_CODENAME, or PRETTY_NAME. For example, . /etc/os-release && echo "$VERSION_ID".

Summary

The best way to check Ubuntu version is lsb_release -a for normal desktop and server systems. For minimal servers, WSL, containers, and scripts, /etc/os-release is usually the most reliable source. Use hostnamectl when you also want kernel, architecture, and hostname details, and use the GUI About page when you are working on Ubuntu Desktop.

Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, …

  • Red Hat Certified System Administrator in Red Hat OpenStack
  • Certified Kubernetes Application Developer (CKAD)
  • Red Hat Certified Specialist in Ansible Automation
  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security