To check your Ubuntu version, run lsb_release -a or cat /etc/os-release in a terminal. This guide is for anyone who has just logged in to a server, or opened Linux on their own PC, and needs to know exactly what it is running before following instructions or installing software.
On Ubuntu, run **lsb_release -a** and read the Description line, for example Ubuntu 24.04.1 LTS. On any modern Linux system, including Debian, AlmaLinux and Rocky Linux, run **cat /etc/os-release** and read PRETTY_NAME. For the kernel version, run **uname -r. On servers with systemd, hostnamectl** shows the operating system, kernel and architecture together.
Why the version matters
Linux is not one product. Ubuntu, Debian, AlmaLinux and Rocky Linux are different distributions (often shortened to distros): each one packages the Linux kernel with its own tools, package manager and release schedule. A command that works on Ubuntu may not exist on AlmaLinux, and a guide written for Ubuntu 20.04 may give the wrong file paths on 24.04.
Knowing the exact version tells you:
- Which instructions to follow. Ubuntu and Debian use
apt; AlmaLinux and Rocky Linux usednf. - Which software versions you will get. Each release ships its own default PHP, NginxNginx A fast, popular program that sends web pages to visitors and can pass requests on to apps behind it. More about Nginx → and MariaDB versions.
- Whether the system still gets security fixes. Every release has an end of support date. After it, no more patches arrive, even if you have automatic security updates turned on.
You need a terminal for every method below. On a remote server, that means connecting with SSH first. If you want somewhere safe to practise, WSL gives you an Ubuntu terminal on a Windows PC.
Check the Ubuntu version
1. Run lsb_release
lsb_release -a
On an Ubuntu 24.04 server you will see something like this:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble
The No LSB modules are available. line is normal and harmless. What each line means:
| Line | Meaning |
|---|---|
| Distributor ID | The distribution name |
| Description | The full name, including the point release (the .1 in 24.04.1) |
| Release | The version number. Ubuntu versions are the year and month of release, so 24.04 came out in April 2024 |
| Codename | The release nickname. Software repositories and some guides use this instead of the number |
If you only want the number, add -r and -s (short):
lsb_release -rs
This prints just 24.04, which is handy in scripts.
2. Check whether it is an LTS release
LTS means Long Term Support. Ubuntu LTS releases come out every two years in April of even years (20.04, 22.04, 24.04) and get five years of standard security updates. Releases in between, such as 24.10, are supported for only nine months. For a server, you almost always want an LTS release. If the Description line does not say LTS, plan to move to one.
Common codenames you will meet on servers:
| Version | Codename |
|---|---|
| Ubuntu 20.04 LTS | focal |
| Ubuntu 22.04 LTS | jammy |
| Ubuntu 24.04 LTS | noble |
Ubuntu publishes the support dates for every release on its release cycle page, linked under Official documentation below.
Check the version on any Linux distribution
Read /etc/os-release
Almost every current distribution has a small text file called /etc/os-release that describes the system. It is the most reliable method because it does not depend on any extra package being installed.
cat /etc/os-release
On a Rocky Linux 9 server the output starts like this:
NAME="Rocky Linux"
VERSION="9.4 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.4"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.4 (Blue Onyx)"
The useful fields:
PRETTY_NAMEis the human-readable name and version.IDis the short name of the distribution (ubuntu,debian,almalinux,rocky).VERSION_IDis the version number on its own.ID_LIKEnames the family it belongs to.rhelmeans instructions written for Red Hat Enterprise Linux will usually work;debianmeans Debian-style instructions apply.
To print just one line, use grep:
grep PRETTY_NAME /etc/os-release
Use hostnamectl
On systems that use systemd (all the distributions named in this guide), hostnamectl gives a tidy summary:
hostnamectl
Look for these lines in the output:
Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.1.0-25-amd64
Architecture: x86-64
This is often the quickest way to see the operating system, kernel and architecture at once. Inside some containers, hostnamectl cannot reach systemd and prints an error instead; use /etc/os-release there.
Distribution-specific files
Older guides often mention these files. They still exist and can give a more precise number:
| File | Found on | Example content |
|---|---|---|
| /etc/debian_version | Debian and Ubuntu | 12.7 on Debian. On Ubuntu it shows the Debian base, such as trixie/sid, not the Ubuntu version |
| /etc/redhat-release | AlmaLinux, Rocky Linux, RHEL, CentOS | AlmaLinux release 9.4 (Seafoam Ocelot) |
Read either with cat, for example cat /etc/redhat-release. Because /etc/debian_version can mislead on Ubuntu, prefer /etc/os-release there.
Check the kernel version and architecture
The kernel is the core of the operating system that talks to the hardware. Its version is separate from the distribution version: Ubuntu 24.04, for example, can run several different kernel versions over its life as updates arrive. You need the kernel version when a vendor’s driver or monitoring agent lists kernel requirements, or when checking that a kernel update has taken effect after a reboot.
uname -r
This prints something like 6.8.0-45-generic. For everything uname knows, including the host name and architecture, use:
uname -a
The architecture is the type of processor the system is built for. Downloads often come in separate builds, so check it before installing software by hand:
uname -m
| Output | Meaning | Download to choose |
|---|---|---|
| x86_64 | Standard 64-bit Intel or AMD | amd64 or x86_64 |
| aarch64 | 64-bit ARM, such as many cloud ARM servers and a Raspberry Pi with a 64-bit OS | arm64 or aarch64 |
On Debian and Ubuntu, dpkg --print-architecture prints the name the package system uses (amd64 or arm64), which matches most download pages.
If you updated the kernel but uname -r still shows the old version, the server has not been rebooted yet. On Ubuntu and Debian, the file /var/run/reboot-required exists while a reboot is waiting.
Common problems
| Symptom | Cause | Fix |
|---|---|---|
lsb_release: command not found | The lsb-release package is not installed, which is common on minimal Debian, AlmaLinux and Rocky Linux images | Use cat /etc/os-release instead. There is no need to install anything |
hostnamectl prints System has not been booted with systemd | You are inside a container or an older WSL setup without systemd | Use cat /etc/os-release |
| Version shows a non-LTS Ubuntu release such as 23.10 | The server was installed from or upgraded to an interim release | Check its support dates and plan an upgrade to the next LTS before support ends |
| Kernel version did not change after updates | The new kernel is installed but not running | Reboot at a quiet time, then run uname -r again |
| Output says CentOS Linux 7 or 8 | These releases have reached end of life and no longer get fixes | Plan a move to a supported distribution such as AlmaLinux or Rocky Linux |
Official documentation
Related
- How to connect to a server with SSH: open the terminal you need for every command here.
- How to turn on automatic security updates: keep a supported release patched without logging in.
- What is WSL? How to run Linux on Windows: practise these commands on your own PC.
- How to set up a firewall on Linux: the next step once you know whether to use UFW or firewalld.
Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.



