Which commands show your Ubuntu and Debian version, how it differs from the kernel version and until which year it is patched.

You have just logged in over SSH and the first question is which system this is. The version decides which guide applies, which package name is right, and whether the system still receives security fixes. Below are the commands that work on both Ubuntu and Debian, what each one prints, and one trap: on Ubuntu, /etc/debian_version does not tell you the Ubuntu version.

In short. Use cat /etc/os-release: it exists on Ubuntu and Debian and shows both the version number and the codename. lsb_release -a prints the same in a friendlier layout but may be missing on minimal images. The kernel version from uname -r is not the OS version. On Debian, /etc/debian_version holds the release; on Ubuntu it only shows the Debian base such as trixie/sid. Ubuntu 24.04 is patched until 2029, 22.04 until mid-2027, Debian 12 gets LTS until mid-2028. ubuntu-security-status will tell you for your own server.

The reliable way: /etc/os-release

Every modern systemd-based distribution describes itself in /etc/os-release. Scripts and installers read it, so the format is standard:

cat /etc/os-release

On an Ubuntu 24.04 server it returns (a few link lines removed):

VERSION_ID is the number you need. VERSION_CODENAME matters when a guide names repositories by codename instead of number. ID_LIKE=debian says Ubuntu is derived from Debian, so Debian-style commands usually apply.

Debian prints a similar file (example for Debian 12, not run on a live server):

lsb_release and hostnamectl

lsb_release -a splits the version into lines. On very small images the lsb-release package may be absent; os-release still works.

lsb_release -a

hostnamectl shows the OS, kernel, architecture and virtualization type together, which is handy for pasting into a support ticket:

hostnamectl

Debian: /etc/debian_version, and the trap on Ubuntu

On Debian the file holds the release including the point release, for example 12.5:

cat /etc/debian_version

On Ubuntu the same file names the Debian branch Ubuntu was built from. On our Ubuntu 24.04 server it prints:

trixie/sid

Taking that for the system version leads to wrong packages and wrong guides. Check Ubuntu with /etc/os-release or lsb_release.

The kernel version is not the system version

uname -r
6.8.0-35-generic

6.8.0 is the Linux kernel, 35 is Ubuntu's build number, generic is the kernel flavour. The system is still 24.04. A new kernel can arrive in a normal update without changing the release, so "upgrade to kernel 6.x" in a guide does not mean a new Ubuntu.

How long your version gets security updates

Ubuntu LTS releases (April of even years, like 22.04 and 24.04) get five years of free security updates. After that you can extend them with an Ubuntu Pro (ESM) subscription, otherwise the server is no longer patched.

Ubuntu

Released

Free security updates until

With Ubuntu Pro (ESM) until

18.04

April 2018

May 2023

April 2028

20.04

April 2020

May 2025

April 2030

22.04

April 2022

June 2027

April 2032

24.04

April 2024

May 2029

April 2034

26.04

April 2026

May 2031

April 2036

Debian has two stages: regular support from the Debian security team, then an LTS period run by volunteers.

Debian

Released

Regular support until

LTS until

10 (buster)

July 2019

September 2022

June 2024

11 (bullseye)

August 2021

August 2024

August 2026

12 (bookworm)

June 2023

July 2026

June 2028

13 (trixie)

August 2025

August 2028

June 2030

Data as of 5 October 2026, months are approximate, check the official release pages for exact dates. Two uncomfortable facts follow: Debian 11 is out of support, and Ubuntu 20.04 lost free security updates in May 2025.

On Ubuntu you can ask the server itself:

ubuntu-security-status

The last two lines are the answer. Main is patched until 2029; no Pro subscription is attached, so packages from Universe are covered only for the free period.

Checking whether a new release is out

do-release-upgrade -c

The -c flag only checks. It installs nothing. If you see that message, a newer LTS exists. Do not rush a production machine, though: a release upgrade rewrites configs, can break third-party repositories and needs a reboot. Take a backup, rehearse on a test server, then do the real one. If the server is new or nearly empty, skip the upgrade: create a fresh server with the current release and move your data.

FAQ

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

The OS version is the distribution release, such as Ubuntu 24.04. The kernel version is the number of the Linux kernel inside it, such as 6.8.0. The kernel updates separately and can change several times within one release.

How do I check the Debian version without lsb_release?

Print /etc/os-release or /etc/debian_version. Both files exist on every Debian system and need no extra packages.

What does LTS mean?

Long Term Support. Ubuntu LTS ships every two years in April and gets five years of free security updates. Servers should run LTS releases.

What if my version is no longer supported?

Plan a move to a current LTS. Until then keep unneeded ports closed, keep the firewall on and do not host anything important there. The cleanest route is a new server with a current system and a data migration.

Summary

  • cat /etc/os-release shows the system version on Ubuntu and Debian.
  • lsb_release -a and hostnamectl show the same in a friendlier layout.
  • On Ubuntu /etc/debian_version prints a Debian base like trixie/sid, not the Ubuntu version.
  • The kernel version (uname -r) and the OS version are different things.
  • Check support in the tables or with ubuntu-security-status. If the version is unsupported, plan a move.
  • do-release-upgrade -c shows a new release but do not upgrade production blindly.