Like every VPS addict it is quite normal to forget which version of an operating system you are running especially if it is a server that you haven’t logged onto for a long time.
In other cases, you may simply be administering quite a few servers with different versions of operating systems and you may not necessary remember what version of Debian is installed on a particular system. Whatever the reason is, we will learn how to check the version of Debian that is running using only the command line.
so without further ado…..
Terminal commands that shows the Debian Version
There are many ways to find the version, here I will show two different ways. Feel free to post more ways in the comment section.
If you only need the version number the easiest way is to execute the following command
1 |
cat /etc/debian_version |
You should get a result like this:
1 |
7.6 |
There you have it, the server is running Debian 7.6!
Another command, that also gives a bit more information is
1 |
lsb_release -a |
You should get a result like:
1 2 3 4 5 |
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 7.6 (wheezy) Release: 7.6 Codename: wheezy |
To find the Kernel version use the ‘uname‘ command. Using it without parameters will only print out ‘Linux’ and if you didn’t know that you were running Linux you are in trouble 🙂
1 |
uname -a |
prints all Kernel information
1 |
uname -r |
prints your kernel version which is useful for installing things like the kernel headers, for example:
1 |
apt-get install linux-headers-$(uname -r) |
Do you know more ways to get the OS version from the command line? Post a comment with your suggestions!
Thanks for help. Can you please tell what font is used in commands like you have written
cat /etc/debian_version, lsb_release -a
it is the Monaco font, using the Crayon Syntax Highlighter plugin.
Very well written guide. Certainly helps when logging into multiple machines.
what should i do if get result like this? I’m run on docker
Start typing lsb and press tab twice.
I have same issue when copy paste from browser.
Try
sudo apt install lsb-release
and restart the terminal. Thelsb_release
command should now be available.Also:
cat /etc/issue
and
/etc/os-release
and on systemd machines,
hostnamectl
(lifted from https://linuxconfig.org/check-what-debian-version-you-are-running-on-your-linux-system)
My question is “Where/how is the canonical version number stored?”
In other words, say my version is Debian 10, but I temporarily need (for a badly-written app’s sake) for it to be Debian 10.0; what file, assuming there is one, would I need to change, and what daemons would I need to restart, etc, for the system to then report that it is version 10.0 instead of 10?
according to the Debian FAQ: https://www.debian.org/doc/manuals/debian-faq/ch-software.en.html#s-isitdebian
the only way to see the minor version is to either use
lsb_release -a
or see inside (if available) the/etc/debian_version
file.thank you for the explanation, but I do not understand what is the use of vps
whether it is useful for this article in the future
amazing content. Thanks for sharing it.
hi guys! How all of you are doing these days.
Give it up for the kingdom. give it up when we bring them down.