Before upgrading Debian, I always start with a simple check: what version is actually running on the machine, and with which kernel? This avoids preparing a procedure for Debian 12 when the server is still on Debian 11, or confusing the distribution version with the kernel version.
In this guide, I’ll show you reliable commands to check a Debian versionunderstand what each result means, and note down useful information before touching the repositories or launching a version upgrade.

Start with /etc/os-release
The most practical command today remains this one:
cat /etc/os-release
On Debian, you should especially look at the lines PRETTY_NAME, VERSION_ID And VERSION_CODENAME. For example, VERSION_ID="12" And VERSION_CODENAME=bookworm indicate a Debian 12 Bookworm base.
This is the first file I consult because it provides clear information, readable by a human, but also usable by scripts. The reference page os-release It also details the expected format of this file.
Also check /etc/debian_version
Debian also provides a specific file:
cat /etc/debian_version
It can return a value like 12.5, 12.6 or sometimes a branch name depending on the context. I use it as a second check, but I don’t stop there. To prepare for an upgrade, the most useful pair remains the major version and the code name: Bookworm, Trixie, Bullseye, etc.
If the two files don’t tell the same story, don’t force an upgrade immediately. First, verify that you are indeed on a standard Debian installation, and not on a custom image, container, appliance, or derivative distribution.
Use lsb_release if the command is available
On many machines, you can also launch:
lsb_release -a
You then get an output with the description, version number, and code name. This is readable and practical when documenting an intervention.
Attention : lsb_release It may not be installed on a minimal Debian system. In this case, do not install a package just to check the version if you are currently troubleshooting. /etc/os-release That’s sufficient in most cases.
Don’t confuse Debian with the Linux kernel
The following command does not return the Debian version. It returns the version of the loaded kernel:
uname -r
This is important information, but different. Two machines running Debian 12 can use different kernels depending on updates, backports, virtualization, or the image installed at the hosting provider.
For a more complete view, I also like to run:
hostnamectl
The output typically displays the operating system, kernel, and sometimes the chassis or virtualization type. This isn’t essential, but it’s useful to know before remote intervention.
My sequence before a Debian upgrade
Before following the Debian release notesI always note down this information:
cat /etc/os-release
cat /etc/debian_version
uname -r
hostnamectl
Only then do I look at the available packages:
sudo apt update
apt list --upgradable
Don’t mix up the steps. Checking the version tells you where you’re starting from. Listing the packages shows you what will change. Upgrading, however, requires reading the official notes, making a backup, and finding a suitable time slot. The page for Debian versions It also allows you to check code names and maintained versions.
If you maintain a server, I also advise you to review your access points before launching anything: SSH, recovery console, recent backup, available disk space. An article on Linux LTS and updates can help put the issue back into the support cycle. And if a restart is planned, keep the checks around systemctl reboot.
After restarting, check that you have arrived safely.
After an upgrade or restart, run the same commands again. It’s a simple thing, but it’s a quick way to see if the machine has booted correctly with the expected version.
cat /etc/os-release
uname -r
systemctl --failed
journalctl -b -p warning..alert
The version may be correct, but a service may have failed to start. In this case, don’t just rely on the Debian version number. Look at the failed units and the current boot logs. The guide on journalctl at last startup is useful for this part.
Above all, remember this rule: /etc/os-release gives you the Debian version, uname -r gives you the core, and hostnamectl It combines the two into a readable view. Before an update, these three controls already prevent quite a few unpleasant surprises.