How to find the Linux distribution version?

Linux is a free open-source operating system. It is based on a Linux kernel which is developed by Linus Torvalds. There are different Linux variants available, they are collectively known as Linux distributions. Debian,Ubuntu,Arch Linux,Fedora,Red Hat Linux,CentOS,Fedora,OpenSUSE, are some popular Linux distributions. We may need to check the operating system name and version using the command line. In this article, we will discuss various command-line methods to find the Linux version. The following methods can be used to find the Linux details

  • lsb_release command
  • hostnamectl command
  • /etc/os-release file
  • /etc/issue file

Checking Linux version using lsb_release command

The lsb_release command can be used to print distribution specific information. LSB is the short of Linux Standard Base.

Firstly, Open the terminal and type following command

lsb_release -a

Finally, from the above lsb_release output, we can identify the version as “Debian Linux 10 (buster)”. Command-line option “-a” will print all the information.

Checking Linux version using hostnamectl command

To query and change the system hostname and related settings hostnamectl command is used. We can use hostnamectl to retrieve Linux distribution details.

Open the terminal and type following command

hostnamectl

From the above output we can see operating system as Debian 10 however it will also print kernel version and architecture etc.

Checking Linux version using os-release file

The os-release file contains operating system identification data. It is is located at following paths – /etc/os-release , /usr/lib/os-release.

Open the terminal and type following command

cat /etc/os-release

From the above output we can see the version and other information related to distribution.

Checking Linux version using issue file

The issue file contains system identification information or message. This information is printed before the login prompt. Therefore we can use the issue file to check the distribution details. Issue file located at the /etc/issue path.

Open the terminal and type following command

cat /etc/issue

In conclusion, Linux provides command-line tools like lsb_release, hostnamectl to get distribution details. The os-release and issue files are helpful to identify Linux distribution details.

Leave a Comment