Linux distributions and versions

How to Find Linux Distribution Release Name and Version

There are many commands in Linux to get the same information and one such command is the lsb_release, which is used to get the Linux distribution-related information such as OS name, code name, release information.

In some Linux distributions, the lsb_release command will be available to use and in some distributions, you have to install it, as this command is part of the LSB-core package.

Check Linux Distribution Information

To check if the lsb_release command is installed run the following command.

$ which lsb_release /usr/bin/lsb_release 

In some distributions like Ubuntu, this command is already available to use but you will get the following error when you try to use some flags.

$ lsb_release -v No LSB modules are available. 

Install lsb-core in Linux Distributions

To fix this you need to install the lsb-core package. Depending upon the distribution you are using run the following commands to install the lsb-core package.

------- On Debian/Ubuntu ------- $ sudo apt-get update $ sudo apt-get install lsb-core ------- On Arch/Manjaro ------- $ pacman -Syu lsb-release ------- On RHEL/CentOS ------- $ sudo yum update $ sudo yum install redhat-lsb-core ------- On Fedora ------- $ sudo dnf update $ sudo dnf install redhat-lsb-core ------- On SUSE ------- $ sudo zypper update $ sudo zypper install lsb-core

Get Linux Distribution Information

Once installed, try to run the lsb_release command again.

Check Linux OS Version

To get the list of available options you can refer to the man page or «-h» flag.

$ man lsb_release $ lsb_release -h

lsb_release Help

To check the description, about your distribution use the ‘-d’ flag.

Читайте также:  Курсы системного администрирования linux

Check Linux OS Description

To check the version information using the ‘-r’ flag.

$ lsb_release -r Release: 20.04 

Every distribution comes with a code name. For example, Ubuntu 20.04 comes with the name “Focal Fossa”. To get the name use the ‘-c’ flag.

$ lsb_release -c Codename: focal 

You can get all the information by using the ‘-a’ flag.

Check Linux OS Information

If you look at the output so far it is in key-value pair. You can just display the value alone by using the ‘-s’ flag.

$ lsb_release -i Distributor ID: Ubuntu $ lsb_release -is Ubuntu 

That’s it for this article. The lsb_release is a simple command to get information about your distribution.

Источник

How To Find Linux OS Distribution and Version?

How To Find Linux OS Distribution and Version?

Linux is a free and open-source operating system. A lot of distributions and versions are created on the Linux kernel. Even all of them are called Linux they have specific names and versions like Ubuntu 20.04, Debian 11, RHEL 8, etc. While working with Linux knowing the distributions and version is very important. Especially while using the command line or bash shell the commands and configuration supported current Linux is important. In this tutorial, we will learn how to list or display current Linux distributions, version, and Linux kernel version.

List Distribution and Versions with lsb_release Command

The lsb_release is a very popular command which is provided by most Linux distributions. The lsb_release command can be used in Ubuntu, Debian, Mint, Kali, Fedora, CentOS, Rocky Linux, RHEL, SUSE etc. The -a option should be provided to the lsb_release command in order to list current distribution name and version.

The output is like below which contains distribution ID, description, release number which can be also called as version and the codename. Codename is used by some Linux distributions in order to name different versions. We can see that current distributions name is “Ubuntu” and version is “20.10”.

Distributor ID: Ubuntu Description: Ubuntu 20.10 Release: 20.10 Codename: groovy

List Distribution and Versions with /etc/os-release File

Some linux distirbutions like Debian, Ubuntu stores the current distributions name and version information in the file named “/etc/os-release”. This file contains detailed information which can be printed to the terminal by using the cat command like below.

Читайте также:  Виртуальная windows for linux

We can see that following information about the distributions and version is provided.

  • NAME: The distributions name which is “Ubuntu” in this example.
  • VERSION: The version of the distribution which is 20.10 in this example.
  • ID: The distribution canonical name which is “ubuntu” in this example.
  • ID_LIKE: The distribution source where “debian” is the source of the Ubuntu.
  • PRETTY_NAME: The distribution human friendly complete name with the distribution name and version.
  • VERSION_ID: The distribution version which is “20.10”.
  • HOME_URL: The distribution official web site URL which is “https://www.ubuntu.com/” in this case.
  • VERSION_CODENAME: This is version code name which is “groovy” in this example.
  • UBUNTU_CODENAME: This is ubuntu version code name which is “groovy” in this example.
NAME="Ubuntu" VERSION="20.10 (Groovy Gorilla)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.10" VERSION_ID="20.10" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=groovy UBUNTU_CODENAME=groovy

If we need to list only the Linux os name and version the grep command can be used to filter the output like below.

grep "^PRETTY_NAME" /etc/os-release

If we want only list the operating system name the following command can be used.

Only distribution version can be printed by grepping the VERSION_ID line like below.

grep "^VERSION_ID" /etc/os-release

Alternatively a text editor can be used to view the current Linux os distribution name and version via the desktop environment.

List Distribution and Versions with hostnamectl Command

The hostnamectl command is used to manage, list, change the hostname and related information. but it can be also used to list the Linux OS name with the version information. Just run the hostnamectl command which will list the Operating System line with the distribution name and version. Also the Kernel line provides the currently installed and running kernel version.

Static hostname: ubuntu Icon name: computer-vm Chassis: vm Machine ID: 295c2cf105a140e5ab505a9e74ff560e Boot ID: ac4b559e8d414569816cd76c3e330727 Virtualization: vmware Operating System: Ubuntu 20.10 Kernel: Linux 5.8.0-45-generic Architecture: x86-64

If you just want to list distribution name and version the grep command can be used filter the “Operating System:” line like below.

hostnamectl | grep "Operating System" 
Operating System: Ubuntu 20.10

List Distribution and Versions with uname Command

The uname command can be also used to list Linux distribution OS names. The -a option should be provided to list all information about the system. This command does not provide the distribution version but lists the kernel version.

Linux ubuntu 5.8.0-45-generic #51-Ubuntu SMP Fri Feb 19 13:24:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

List Distribution and Versions with /proc/version File

The /proc/ directory contains information about the system and low level operations and functions. The /proc/version can be used to list current distribution name but the version information is not provided.

Linux version 5.8.0-45-generic (buildd@lcy01-amd64-010) (gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0, GNU ld (GNU Binutils for Ubuntu) 2.35.1) #51-Ubuntu SMP Fri Feb 19 13:24:51 UTC 2021

List Distribution and Versions with /etc/issue File

The /etc/issue file only contains the current Linux distribution name and version. This is very simple file and can be listed with the cat command.

Читайте также:  Устройство не управляется alt linux

List Distribution and Versions by Connection SSH

Even this is not a practical way to display the current Linux distribution name and version it can be used for different cases. When we login to the Linux system with the SSH protocol the current distribution name and version are listed below. In the following example, the Linux OS name is Ubuntu and the version is 20.10.

Источник

Оцените статью
Adblock
detector