Which Debian version am I running? You need the answer in situations such as when you are looking for a software that is available for certain Debian version only.
Knowing Debian version is helpful in many situations. Here’s how to do it.
How to check Debian version?
The simplest way you can check Debian version is using the lsb_release command:
Here’s the output:
[email protected]:~ $ lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 10 (buster) Release: 10 Codename: buster
The lsb_release is my favorite command as it can be used to check the version of most Linux distribution (if not all). For example, you can use it to check CentOS version as well.
But that’s not the only way. There are other commands to find Debian version in Linux terminal.
Other methods to show Debian version
Do you recall the Linux directory structure? The /etc directory has the core configuration files and you can use them to find a lot of useful information about your system including the distribution version number.
Here are two ways to do that:
[email protected]:~ $ cat /etc/issue Raspbian GNU/Linux 10 \n \l
The above command output shows that I am running Raspbian GNU Linux 10. If you don’t like the way this output is presented, you can use this method to get just the version number of Debian.
[email protected]:~ $ cat /etc/debian_version 10.0
But this one misses other crucial information. This is why recommend reading the dedicated file for this purpose:
Its output will show you a number of information like version umber, the code name and the project related URLs.
[email protected]:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Another evergreen way is to use systemd command hostnamectl. It’s mainly used for managing the hostname but you can also use it to get Debian version along with the kernel version.
You can see the Debian version under the Operating System line.
[email protected]:~ $ hostnamectl Static hostname: raspberrypi Icon name: computer Machine ID: 0035faf761f945b8923fc7d54632a941 Boot ID: 6de8d489b3a24b6996bd08c9992a6de3 Operating System: Raspbian GNU/Linux 10 (buster) Kernel: Linux 4.19.29-v7l+ Architecture: arm
So, you just saw five ways to check Debian version. Which command did you like the most? Let me know in the comments.