After reading this, you’ll know how to use different commands to do this task.
In order to know which Debian version or Linux distribution are we running among more information on our system, I will explain a variety of simple alternatives.
1.- Learn which version of Debian you are running using hostnamectl.
Hostnamectl is a good choice for systems using systemd to check the OS version. Just run it without parameters, and the output will show what Debian version you are running.
As you see, the command returns information on the hostname, operating system, and kernel version, architecture, among more including virtualization software if you are working on a virtual guest.
2.- See which Debian version you are running using lsb_release:
Before starting, you probably need to install LSB (Linux Standard Base) to use the command lsb_release, which prints information on the system, open a terminal and as root, or using sudo, execute the following commands:
sudo apt upgrade
sudo apt install lsb
In my case, the package was installed, if you didn’t have it previously, packages would be installed and you will be able to use the lsb_release command after confirmation.
This command brings information on the Linux distribution we are running.
The syntax to use is:
lsb_release [options]
To get all available options, we can rub lsb_release -h, and the output will show some documentation:
Among the available options, we find:
- -h, –-help Prints the help menu.
- -v, –-version Shows LSB modules supported by the system.
- -i, –-id Shows the Linux distribution.
- -d, –-description Prints a description of the Linux Distribution.
- -r, –-release Shows the distribution version.
- -c, –-codename Shows the distribution codename.
- -a, –-all Prints all the information mentioned above.
- -s, –-short Prints the output in short format.
For example, if we run lsb_release -a, the command will return the following output:
Note: if executed without options, the command “lsb_release” will apply the -v option by default.
3. Learn which version of Debian you are running using the command cat.
Using the command cat, we can check our distribution ID, description, version, and codename among more information by displaying the information from the files containing it.
To learn what distro are we using with the command cat, you can run:
With a cat, we can also check the kernel and gcc versions used to build it. To do it, run:
Which should return an output similar to the following image:
Note: we can edit the information stored on /etc/*-release files to change the output of lsb_release.
4.- Learn which version of Linux you are running with the uname command.
The command uname (Unix name) is a program for Unix and its based systems; if we compare, the command is similar to the command ver used in MS-DOS systems. It shows basic information about the operating system, processor, and more.
Syntax: uname [parameter]
When used without parameters, the command uname will show only the operating system’s name, but not the distribution, kernel, etc. When used without parameters, the command uname will adopt the -s option by default.
The parameter –help will show brief documentation on the command uname. Here we can find a variety of options:
Parameter | Description | |
---|---|---|
-s | –-kernel-name | This is the option by default. |
-n | –-nodename | shows the hostname. |
-r</em> | –-kernel-release | Shows the kernel version. |
-v | –-kernel-version | Shows the kernel publication date. |
-m | –-machine | print information on the hardware |
-p | –-processor | To check the CPU |
-i | –-hardware-platform | shows the hardware implementation based on kernel modules. On Linux systems, this command almost always returns “unknown”; this option can be ignored. |
-o | –-operating-system | Shows the OS version. |
–-help | Prints the help menu with instructions. | |
–-version | Shows command’s version. |
Note: The command uname -o will read the file ostype located at /proc/sys/kernel as shown in the following image.
As explained before, the -v parameter will return the uname command version:
When used the option -a (–all), the command will return the following information:
- Kernel name
- Domain name (localhost.localdomain).
- Kernel version.
- Kernel date release…
- Hardware and CPU type.
- Architecture
- Operating system.
Additionally, we can combine different options; for example, let’s print the kernel name and version by running:
The options order won’t affect the output as shown in the following example in which I invert the orders of the options while the output remains the same:
Conclusion:
As you can see, checking the system version is pretty easy and can be done through various available options. All examples explained above are simple to implement and provide additional details on the system.
I hope this tutorial explaining how to see which version of Debian you are running was useful. Keep following us to get more updates and tips on Linux.