Debian

Which Version of Debian Am I running?

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:

Learn which version of Debian are you running using the command uname.

The command uname (Unix name) is a program for Unix and it’s 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 name of the operating system, but not the distribution, nor kernel,etc.  When used without parameters the command uname will adopt the -s option by default.

The parameter –help will show a 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    –-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 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.

The format seems like:

kernel-name nodename kernel-release kernel-version
processor hardware-arch operating-system

In my case the exact output is:

Linux linuxhint 4.19.0-5-amd64 #1 SMP Debian
4.19.37-5+deb10u1 (2019-07-19) x86_64 GNU/Linux

Additionally we can combine different options, for example, let’s print the kernel name and version by running:

uname -sr

The options order won’t affect the output as shown in the following example in which I invert the options orders while the output remains the same:

uname -rs

Learn which version of Debian are you running using the command 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:

apt update
apt upgrade
apt install lsb

In my case the package was installed, if you didn’t have it previously after confirmation packages will be installed and you will be able to use the lsb_release command.

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.

Learn which version of Debian are you running using the command cat.

 Using the command cat we can check the ID, description, version and codename of our distribution 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:

cat /etc/*-release

With cat we can also check the kernel and gcc versions used to build it. To do it run:

cat /proc/version

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.

Learn which version of Debian are you running using the command hostnamectl.

Hostnamectl is another alternative for distributions with systemd, check it by running in the terminal

hostnamectl

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.

Conclusion:

While in Windows based systems we can use commands such as systeminfo, ver or cmdinfo there are not enough options to restrict or specify the information to be printed. Linux diversity of alternatives and options through the command line offers more speed and accuracy.

Thank you very much for following LinuxHint. Keep following us to get more updates and tips on Linux. For any Linux or networking related inquiry don’t hesitate to contact us through our support channel https://support.linuxhint.com.

About the author

Ivan Vanney

Ivan Vanney

Ivan Vanney has over a decade working as sysadmin. He is s contributor on LinuxHint.com, and the founder of linuxer.info