Check which Linux distribution and version you're running

Find out exactly which Linux distribution, release and kernel your VPS runs, using /etc/os-release, hostnamectl, lsb_release, uname and the distribution-specific release files.

  • Beginner
  • Linux VPS
  • 4 min read

By RunRacks Team · Published

Before you follow an install guide, open a support ticket or plan an upgrade, you need to know exactly which Linux distribution and version the server runs. Package names, file paths and commands all depend on it. This guide shows several ways to check, which ones work everywhere, and how to read the kernel version.

Before you start

The universal answer: /etc/os-release

Every current distribution, including Ubuntu, Debian, AlmaLinux and Rocky Linux, has /etc/os-release. It is the most reliable place to look:

Terminal
cat /etc/os-release

On Ubuntu 24.04 the output starts like this:

Text
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian

The fields that matter most:

  • PRETTY_NAME: the human-readable name and version.
  • ID: a short lowercase name such as ubuntu, debian, almalinux or rocky.
  • VERSION_ID: the release number, such as 24.04, 12 or 9.4.
  • ID_LIKE: the family. Ubuntu shows debian; AlmaLinux and Rocky show values such as rhel centos fedora. This tells you whether apt or dnf instructions apply.

To print just one line, use grep:

Terminal
grep PRETTY_NAME /etc/os-release

hostnamectl: OS, kernel and virtualization

On any system that uses systemd, hostnamectl gives a tidy summary:

Terminal
hostnamectl

Look for these lines:

Text
Operating System: AlmaLinux 9.4 (Seafoam Ocelot)
          Kernel: Linux 5.14.0-427.13.1.el9_4.x86_64
    Architecture: x86-64
  Virtualization: kvm

It shows the OS, the running kernel, the CPU architecture and the virtualization type in one place. The exact lines vary a little between systemd versions.

lsb_release on Ubuntu and Debian

lsb_release is common on Ubuntu:

Terminal
lsb_release -a
Text
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:        24.04
Codename:       noble

It is not always installed. Debian minimal images and AlmaLinux or Rocky usually lack it, so prefer /etc/os-release in scripts. You can install it on Debian or Ubuntu with sudo apt install lsb-release.

Distribution-specific release files

Older scripts and guides sometimes read these files. They are still useful for extra detail.

Debian and Ubuntu

Terminal
cat /etc/debian_version

On Debian 12 this prints a point release, such as 12.7. On Ubuntu it prints the Debian release it is based on, such as trixie/sid, which is not the Ubuntu version. Use /etc/os-release on Ubuntu.

AlmaLinux and Rocky Linux

Terminal
cat /etc/redhat-release
Text
Rocky Linux release 9.4 (Blue Onyx)

AlmaLinux also has /etc/almalinux-release and Rocky has /etc/rocky-release. All contain the same one-line summary, including the minor version.

Check the kernel with uname

The distribution and the kernel are separate. The kernel version tells you which Linux kernel is running right now:

Terminal
uname -r
Text
6.8.0-45-generic

Other useful forms:

  • uname -m: the architecture, usually x86_64 or aarch64.
  • uname -a: everything in one line.

After a kernel update, uname -r keeps showing the old version until you reboot. That is a quick way to tell whether a reboot is still pending.

Is my version still supported?

Knowing the version is the first step; the second is checking it still gets security updates. Compare your VERSION_ID with the vendor's lifecycle page, or read Linux release lifecycles. On Ubuntu, ubuntu-security-status (or pro status on systems with the Ubuntu Pro client) summarises what support your packages receive.

Check it works

Run this one-liner. It prints the distribution, version and kernel together:

Terminal
. /etc/os-release && echo "$PRETTY_NAME | kernel $(uname -r)"

You should see something like Debian GNU/Linux 12 (bookworm) | kernel 6.1.0-26-amd64. Use that line when you open a support ticket.

Troubleshooting

  • `lsb_release: command not found`: it is not installed. Use cat /etc/os-release instead.
  • `hostnamectl` fails inside a container: containers often run without systemd. Read /etc/os-release directly.
  • The version looks older than you expected: if you upgraded the release recently, check that the upgrade finished. If uname -r is old but packages are new, reboot to load the new kernel.
  • `/etc/os-release` is missing: the system is very old or heavily customised. Try ls /etc/*release* to see which release files exist.

Next steps

Was this guide helpful?

Still stuck?

Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.

Getting started

Edit files with nano: a beginner's guide

Open, edit, search and save files with the nano text editor on a Linux server, including cutting and pasting lines, showing line numbers and safely editing system config files with sudo.

  • Beginner
  • Linux VPS
  • 5 min read

Getting started

Your first hour with a new RunRacks server

A step-by-step roadmap for the first hour after your RunRacks server is delivered, from finding your login details to changing the password, updating the OS and picking your next guides.

  • Beginner
  • All
  • 5 min read

Getting started

How to choose a server location

Pick a data center location based on where your users, broker or team are, confirm it with ping tests, and weigh the legal and latency points that come with each choice.

  • Beginner
  • All
  • 4 min read