How to check Your Linux Version

This post will guide you how to check the version of your Linux. How to find out what CentOS/Ubutnu Linux version you are running.

There are many ways to check what version of Linux that you are running.

Method1: Using Hostnamectl Command to Check Linux Version

You can use the hostnamectl command to find out what Linux version you are running. just type the following command:

# hostnamectl

Outputs:

devops@devops-osetc:~/working$ hostnamectl
Static hostname: devops-osetc
Icon name: computer-vm
Chassis: vm
Machine ID: 059a07d442e846d4b85243bd416818a8
Boot ID: 72aad93b388d468691ebd0580a17b96b
Virtualization: oracle
Operating System: Ubuntu 16.04.2 LTS
Kernel: Linux 4.8.0-36-generic
Architecture: x86-64
devops@devops-osetc:~/working$

From the above output, you can find out what Ubuntu version you are running. and you can also get the version of kernel.

Method2: Checking /etc/issue File to Get Linux Version

You can also check the /etc/issue file to get the current Linux version. just type:

# cat /etc/issue

Outputs:

devops@devops-osetc:~/working$ cat /etc/issue
Ubuntu 16.04.2 LTS \n \l

Method3: Using lsb_release Tool to Check Linux Version

You can also use the lsb_release tool to find out the current Linux version. and you need to install one package before you run this tool. type:

$ sudo apt-get install lsb-core

Outputs:

devops@devops-osetc:~/working$ sudo apt-get install lsb-core
sudo: unable to resolve host devops-osetc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:

Install these packages without verification? [y/N] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liblockfile-bin amd64 1.09-6ubuntu1 [10.8 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 liblockfile1 amd64 1.09-6ubuntu1 [8,056 B]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 zlib1g amd64 1:1.2.8.dfsg-2ubuntu4.1 [51.2 kB]
Setting up debhelper (9.20160115ubuntu3) ...
Setting up alien (8.95) ...
Setting up lsb-core (9.20160110ubuntu0.2) ...
Setting up dh-strip-nondeterminism (0.015-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.10) ...
Processing triggers for ureadahead (0.100.0-19) ...

Then type the lsb_release command with -a option:

# lsb_release -a

Outputs:

devops@devops-osetc:~/working$ lsb_release -a
LSB Version: core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

Method4: Checking /etc/os-release file to Get Linux Version Information

You can try to check the /etc/os-release file to find out the current Linux version, type:

# cat /etc/os-release

Outputs:

devops@devops-osetc:~/working$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

 

You might also like:

Sidebar



back to top