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


[email protected]:~/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
[email protected]:~/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


[email protected]:~/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


[email protected]:~/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 xenial/main amd64 liblockfile-bin amd64 1.09-6ubuntu1 [10.8 kB]
Get:2 xenial/main amd64 liblockfile1 amd64 1.09-6ubuntu1 [8,056 B]
Get:3 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


[email protected]:~/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


[email protected]:~/working$ cat /etc/os-release
VERSION="16.04.2 LTS (Xenial Xerus)"
PRETTY_NAME="Ubuntu 16.04.2 LTS"


You might also like:


back to top