How To Easily Check OS Version In Linux

Check Linux Version

There actually are some ways how you can check the OS version in Linux easily. However, if you are new to Linux, you may be clueless about this. Hence, I would like to share the easiest way to check Linux’s OS version in this post.

I believe that you are well aware Linux is not as famous as the other OS like Windows.  However, many people find that Linux is the OS they need in accordance with their needs. One of the things that makes it interesting is that this OS is an open-source and free OS.

If you care enough, Linux has more than just one variant or distribution. For instance, RHEL, Ubuntu, CenTos, Arch, OpenSuse, Debian, Suse, and Fedora. They are the most well knows Linux distributions. What is the need of knowing your OS version in Linux? Well, if you are knowing the OS version in Linux you are using, it will be useful for the sake of security system security purposes.

Check and Find Out Linux OS Version

There are some steps you need to follow in order to check the OS version and name in Linux. Please see the below steps.


  1. First of all, you will need to open the bash shell (terminal application).
  2. Please use ssh user@server-name for remote user login.
  3. Here below are the commands you can use to check the OS version and name: cat /etc/os-release, lsb_release -a , and hostnamectlLet us see one by one.

Checking Linux OS Version and Name With hostnamectl

This command is strongly recommended for System based Linux distro users. When you use this command, you will be able to check the Linux OS version and kernel version. All you need to do is type the command $hostnamectl. Here is the output sample for OpenSuse Linux:

Static hostname: opensuse-nixcraft
Icon name: computer-vm
Chassis: vm
Machine ID: b8348dbd45d428fa513ab6a9636d1a8
Boot ID: 9a144556789241e29b62b962cfb6ba1d
Virtualization: kvm
Operating System: openSUSE Leap 15.2
CPE OS Name: cpe:/o:opensuse:leap:15.2
Kernel: Linux 4.2.18-lp152.50-default
Architecture: x86-64

Show Linux OS Version With cat /etc/os-release Command

To find the Linux version using the cat /etc/os-release is the most secure way to use it. What you need to do is only to type: $ cat /etc/os-release and the output you will see will be as below:

NAME=”Ubuntu”
VERSION=”19.02.2 LTS (Focal Fossa)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=”Ubuntu 19.02.2 LTS”
VERSION_ID=”19.02″
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

Using The lsb_release -a

When you choose to use the lsb_release -a command, LSB in here stands for Linux Standard Base . To perform this command, you just need to type $lsb_release -a and the output will be as follow:

LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 8.5.1807 (Core)
Release: 8.5.1807
Codename: Core

Summary

The basic need of knowing the Linux OS version name is solely for security purposes. There are three recommended commands that you can use to check the OS version and name in Linux. They are the hostnamectl, cat /etc/os-release, and lsb_release -a

The hostnamectl is preferred for System based Linux distro users. While for play-savers, I suggest you use the cat /etc/os-release. Each command can help you to check your Linux OS version, but which one to choose is always on your call.



%d bloggers like this: