Best Ways to Find Your Linux Distribution Name and Their Version

Let’s say you have joined a new company, you want to install some software requested by the Dev team and you want to restart some service after installation.

what to do?

In this situation at least you should know what Distribution and Version is running on it.It will help you perform the activity without any issue.

Administrator should gather some of the information about the system before doing any activity, which is first task for him.

There are many ways to find the Linux distribution name and version. You might ask, why I want to know this basic things?

We have four major distributions such as Red Hat (RHEL), Debian, openSUSE and Arch Linux.

Each distribution comes with their own package manager which help us to install packages on the system.

If you don’t know the distribution name then you wont be able to perform the package installation.

Also you won’t able to run the proper command for service bounces because most of the distributions implemented systemd command instead of SysVinit script.

It’s good to have the basic commands which will helps you in many ways.

Use the following Methods to Check Your Linux Distribution Name and Version.

It can be done using the following five methods

  • hostnamectl Command
  • lsb_release Command
  • /etc/*-release File
  • uname Command
  • /proc/version File

Method-1: How to Find Your Linux Distribution Name and Their Version Using the systemctl Command

hostnamectl command is used to query and change the system hostname and related settings.

Run the hostname command to find the Linux distribution name, version, and other useful information.

$ hostnamectl

   Static hostname: daygeek-Y700
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 31xxxbdexxx3xxxx3xxxx0xxxx2xxxxc
           Boot ID: 91xxxbdexxx3xxxx3xxxx0xxxx2xxxxc
  Operating System: Manjaro Linux
            Kernel: Linux 4.19.96-1-MANJARO
      Architecture: x86-64

$ hostnamectl | grep -i "operating system"
  Operating System: Manjaro Linux

Method-2: How to Find Your Linux Distribution Name and Their Version Using the lsb_release Command

LSB stands for Linux Standard Base that prints distribution-specific information such as Distribution name, Release version and code name.

$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial

Method-3: How to Find Your Linux Distribution Name and Their Version Using the /etc/*-release File

Release file typically known as Operating system identification. The /etc directory contains many files that contains various information about the distribution. Each distribution has their own set of files, which display this information.

You can find the files below in most distributions.

$ cat /etc/issue
Manjaro Linux \r  (\n) (\l)

$ cat /etc/os-release
NAME="Manjaro Linux"
PRETTY_NAME="Manjaro Linux"

Also, you can use the distribution specific command as follows.

For common syntax is as follows.

cat /etc/[Distro_Name]-release

For instance, we have taken the output from CentOS 7.7.

$ cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)

Method-4: How to Find Your Linux Distribution Name and Their Version Using the uname Command

uname (refers to the UNIX name) is an application that prints system information such as the host name, Linux kernel version and other details of the operating system on which it is running.

$ uname -a

Linux daygeek-Y700 4.19.96-1-MANJARO #1 SMP Wed Jan 15 08:41:50 UTC 2020 x86_64 GNU/Linux

Method-5: How to Find Your Linux Distribution Name and Their Version Using the /proc/version File

The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information.

It’s sometimes referred to as a process information pseudo-file system. It doesn’t contain ‘real’ files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc).

This file specifies the version of the Linux kernel, the version of gcc used to compile the kernel, and the time of kernel compilation. It also contains the kernel compiler’s user name (in parentheses).

$ cat /proc/version

Linux version 4.19.96-1-MANJARO ([email protected]) (gcc version 9.2.0 (GCC)) #1 SMP Wed Jan 15 08:41:50 UTC 2020

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...