Find release version linux

4 Useful Commands to Check Linux Version

How to check Linux version is a commonly asked question during a Linux job interview. The OS version of a Linux distribution can be determined by using the command-line interface as well as a graphical user interface.

In Linux, CLI is preferred over GUI as it provides more control over the OS. In this article, we will mostly focus on the command line methods which can be used to check the OS version of a Linux distribution.

What is the difference between Linux and other operating systems?

Linux is an open source operating system that was created in 1991 by Linus Torvalds. It is different from other operating systems because it is based on the Linux kernel. Linux is also free and can be used on a variety of devices.

What is the best Linux distribution?

The most popular and widely used distributions are Ubuntu, Debian, Red Hat Enterprise Linux (RHEL), CentOS, Fedora. Other distros include Arch Linux, Gentoo Linux and openSUSE.

What are the benefits of using Linux?

Some of the benefits of using Linux include its stability, security, flexibility and cost. Linux is also a more secure operating system than Windows. It can be used on a variety of devices, including desktops, laptops, servers and smartphones.

Check Linux version from /etc/os-release

The best way to check Linux version is using cat /etc/os-release command. This command will list Linux distribution name and release version information. It works on almost all Linux system.

If we are running a very old Linux distribution then we might not be able to use any of the above commands. Use the following command to know the OS version on our old system:

  • ———- On Red Hat Linux ———-
    $ cat /etc/redhat-release
  • ———- On CentOS Linux ———-
    $ cat /etc/centos-release
  • ———- On Fedora Linux ———-
    $ cat /etc/fedora-release
  • ———- On Debian Linux ———-
    $ cat /etc/debian_version
  • ———- On Ubuntu and Linux Mint ———-
    $ cat /etc/lsb-release
  • ———- On Gentoo Linux ———-
    $ cat /etc/gentoo-release
  • ———- On SuSE Linux ———-
    $ cat /etc/SuSE-release

Check Linux version with uname command

We can also use uname command to check Linux version. It is used to print our Linux system information such as kernel version and release name, network hostname, machine hardware name, processor architecture, hardware platform and the operating system.

Читайте также:  Linux with wireless support

The command uname -a shows the version of the Linux kernel we are using, as well as additional details.

Linux deb-srv 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux

Check Linux version from /proc/version

As we can see, the /proc/version 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.

Check Linux version with lsb_release command

The lsb_release command is a helpful utility to find out information about our Linux installation. It displays LSB (Linux Standard Base) information about the Linux distribution.

lsb_release -a
Output
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

To display only the description, run:

Ubuntu, Debian, Fedora, openSUSE, and Mint are all popular Linux distros.

What is the difference between Linux distributions?

There are many different types of Linux distributions, also called distros. Each one has its own features, but the core components are the same.

Why are there so many Linux distributions?

There are many reasons why there are so many Linux distributions. One reason is that Linux is open source, which means that anyone can create a new distribution. Linux is also very customizable, which means that people can create distributions that fit their needs or preferences. Additionally, different Linux distributions can appeal to different types of users. For example, some distributions are more geared towards beginners, while others are more geared towards experts.

How do I change my Linux distribution?

You can always switch to another distro if you find that it works better on your system or meets more of your needs. You will want to make sure that your system meets the requirements of the new distro, and you may need to reinstall some applications.

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

howtouselinux.com is dedicated to providing comprehensive information on using Linux.

We hope you find our site helpful and informative.

Источник

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.

Читайте также:  Linux add directory to archive

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.

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 Which Linux Version You Are Running

Logged in on a Linux system via SSH and wondering which Linux distribution is it? Here’s how to check the Linux version.

When you install a Linux distribution on your own, you know which distribution and version it is.

But if you use SSH to log in to a remote Linux server provided by an enterprise or client, you may wonder which Linux distribution and version it is.

The simplest way to check Linux version is to see the content of the /etc/os-release file:

It will show an output similar to this:

NAME="Ubuntu" VERSION="20.04.1 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.1 LTS" VERSION_ID="20.04" 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=focal UBUNTU_CODENAME=focal

As you can see, the Linux name is Ubuntu and the version is 20.04.1.

However, that’s not the only way to know the Linux distribution details. In this beginner’s tip, I’ll show you different ways to check which Linux you are running.

Find Linux distribution details

How to check Linux version

Method 1: Use /etc/os-release file

If you are familiar with the Linux directory structure, you probably already know that /etc directory contains the core configuration files of the system.

Читайте также:  Настройка серверного по linux

The os-release file in the /etc directory keeps the information about the Linux distribution. It gives you the distribution name, distribution version, release name or ID.

Here’s what it displays for Alpine Linux server running on Linode infrastructure.

handbook:~# cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.12.0 PRETTY_NAME="Alpine Linux v3.12" HOME_URL="https://alpinelinux.org/" BUG_REPORT_URL="https://bugs.alpinelinux.org/"

As you can see, the name of Linux distribution is Alpine Linux and the distribution version is 3.12.

The content of the /etc/os-release is usually different for different distributions. Distributions often use it to provide additional information like where to get support or file bugs etc.

For example, the /etc/os-release provides more lines for CentOS Linux.

NAME="CentOS Linux" VERSION="8 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="8" 

However, all of them provide the Linux distribution name and version so it is a pretty reliable way to know which Linux you are running. In fact, it is the most reliable way.

Method 2: Use hostnamectl command

Most Linux distributions these days use systemd. On such a system, you can use the hostnamectl command to get Linux version detail.

For the same CentOS system that you saw above, hostnamectl provides the following details:

[[email protected] ~]# hostnamectl Static hostname: localhost.localdomain Transient hostname: li2498-99.members.linode.com Icon name: computer-vm Chassis: vm Machine ID: e3fe2be3e17be3e1763bf43e8337e68b Boot ID: 33d3052bbffd44b1869bbffd4b00d26c Virtualization: kvm Operating System: CentOS Linux 8 (Core) CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.18.0-147.8.1.el8_1.x86_64 Architecture: x86-64

You can see the Linux version detail in the line starting with ‘Operating System’.

The hostnamectl command is primarily used for dealing with the hostname but if it provides other details why not use it?

Method 3: Use lsb-release command

This is NOT a command that you’ll find in all Linux distributions. I think it is mostly used by Debian/Ubuntu based distributions.

You can use the lsb_release command with option -a and it will provide distribution details:

Don’t mind the No LSB modules are available line. It’s not an error of any kind.

[email protected]:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

Bonus Tip: Find Linux kernel version

Now that you know which distribution you are running, perhaps you would also like to know about the Linux kernel version running on the system.

You can get the kernel details using the uname command in any Linux distribution.

The output shows only the Linux kernel version:

handbook:~# uname -r 5.4.43-1-virt

No prizes for guessing that the above system is running on Linux kernel version 5.4.43.

I hope you find this quick tip helpful in finding Linux version detail. If you have questions or suggestions, please let me know in the comment section.

Источник

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