3 ways to find out which Debian version a server is using
What's in the box?
You're connected to a Linux server, in this case running Debian, but you don't know which Debian version the server is running? It's easy to obtain this information in a variety of ways, as we'll see in this tutorial.
In production, you should use a stable version of the Debian distribution. However, you should be aware that there are three versions of Debian available: Stable for production, Testing which is currently being tested to become the next stable version, and Unstable (known as Sid), which is in the active development phase.
1. Display Debian version with lsb_release
The first way to obtain information on the Debian version used by your server is to use the "lsb_release" command like this:
lsb_release -a
Looking at the command output, you can see the "Description" with the version name:
To obtain this information directly, use this syntax :
lsb_release -d
2. Display Debian version with os-release
Another method is to consult the contents of the "/etc/os-release" file, since it contains information specific to the system version. This gives :
cat /etc/os-release
In the example below, the "PRETTY_NAME" field gives the full name of the Debian version.
3. Display Debian version with hostnamectl
The third method proposed in this article is to use the " hostnamectl" . Initially, this utility is used to configure the host name of a Linux server. However, it also provides other information, such as the OS name and Linux kernel version. Simply run the command :
hostnamectl
Looking at the output, we can see the "Operating System" field with the name of the Debian version: Debian GNU/Linux 11 (bullseye).
4. Conclusion
Thanks to this article from the Computer Tutorials box, you will be able todisplay the Debian version used by your serverall from the command line. The information relayed is the same for each method, so the choice is yours.
Resources :