How to check Debian version can be done in multiple ways. We will have a look at 5 different ways to check which version of Debian you are running, or someone else.
5 ways on How to check Debian version
Method 1: lsb_release -a
This method will work no matter what Debian version you are running. It will give you Distro name, release and code name. Works on other linux distros as well.
ronny@skynet:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster
If you don’t have the standard tools installed, you might need to install
apt-get install lsb-release
Method 2: issue file
The issue file is an all Linux version and can be used not only for checking Debian version. Some Linux distros display the content of issue file when logging in.
ronny@skynet:~$ cat /etc/issue Debian GNU/Linux 10 \n \l
As you can see this method doesn’t give you the point releases. It only shows the Major Debian release like 10, 9, 8 and so on.
Method 3: debian_version file
This file is of course only in Debian. When displaying the content of debian_version it will show major and point release. I often use this when checking which Debian version that is installed.
ronny@skynet:~$ cat /etc/debian_version 10.0
Method 4: os-release
The os-release file has only been around since Systemd came. So your Debian release needs to be newer than 2010 for this to work.
ronny@skynet:~$ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
As you can see it gives more information than the others above.
Method 5: hostnamectl
ronny@skynet:~$ hostnamectl Static hostname: skynet Icon name: computer Machine ID: 23f14448894b403484c9e5b0c28ea118 Boot ID: ff29a33d0b574cb098be5752181e5436 Operating System: Debian GNU/Linux 10 (buster) Kernel: Linux 4.19.0-5-amd64 Architecture: x86-64
Use the one you find the easiest or most comfortable using. It was just to show there are several ways on how to check
Check out Debian official webpage for the installation files.
Struggling with slow ssh logins to your Debian System?