Looking to check what Linux Operating System you’re using or the Linux kernel version?

Linux represents a collection of open-source operating systems built around the Linux kernel. These operating systems are known as Linux Distributions, and some of the most popular ones are Debian, Ubuntu, Fedora, CentOS, Arch Linux and OpenSUSE.

Whether you’ve just spun up a server, or simply forgotten your distro or kernel, these things are good to keep in mind for potential software compatibility issues or security patches.

Check Linux Distribution Name, Version & Kernel

To find the Linux operating system’s name, version or kernel:

  1. Open up a terminal (on desktop) or log in via SSH (on a remote server)
  2. Run any of the following commands to check the Linux OS version details:
cat /etc/os-release
cat /etc/issue
lsb_release -a
hostnamectl
  1. To check the Linux Kernel version, run one of the following commands:
cat /proc/version
uname -a

Let’s explore each of the commands a little more in depth.

Check Linux OS Version Using “cat /etc/os-release”

A reliable way to check your Linux OS name and version is checking the contents of the /etc/os-release file.

This command works on multiple distributions. In this guide we’re testing it on CentOS, Debian and Linux Mint (which is based on Ubuntu).

As you’ll see, the other commands may not work on expected on every distro.

Let’s check the output of this command on the distros mentioned above:

$ cat /etc/os-release

CentOS

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Debian

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Linux Mint

NAME="Linux Mint"
VERSION="19 (Tara)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 19"
VERSION_ID="19"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=tara
UBUNTU_CODENAME=bionic

Check Linux OS Version Using “cat /etc/issue”

Again, we’ll use the cat command, to check the contents of a file. In this case, we’re checking the contents of the /etc/issue file, which contains system identification text:

CentOS

\S
Kernel \r on an \m

Debian

Debian GNU/Linux 9 \n \l

Linux Mint

Linux Mint 19 Tara \n \l

Check Linux OS Version Using the “lsb_release” Utility

lsb_release is a utility that displays Linux Standard Base information about the Linux distro. Although it is useful for easily displaying version information in a straightforward manner, it’s not always installed by default.

Let’s see for ourselves:

$ lsb_release -a

CentOS

-bash: lsb_release: command not found

Debian

No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.4 (stretch)
Release:	9.4
Codename:	stretch

Linux Mint

No LSB modules are available.
Distributor ID:	LinuxMint
Description:	Linux Mint 19 Tara
Release:	19
Codename:	tara

Check Linux OS Version Using “hostnamectl”

hostnamectl is a command that lets you display the hostname of the machine, but you can also use it to check a few more details, among them being your OS version and kernel:

$ hostnamectl

CentOS

   Static hostname: panel.dracula.host
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 96820b9851c24560b5f942f2496b9aeb
           Boot ID: deed538f7ff243a1b4c6d21fe6c0cf5e
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-957.1.3.el7.x86_64
      Architecture: x86-64

Debian

   Static hostname: dracula.host
         Icon name: computer-vm
           Chassis: vm
        Machine ID: c692d2988d47468fa27dd7eae4b96e86
           Boot ID: 6ec9d3271bab4a31a76e38921510339a
    Virtualization: kvm
  Operating System: Debian GNU/Linux 9 (stretch)
            Kernel: Linux 4.9.0-4-amd64
      Architecture: x86-64

Linux Mint

   Static hostname: dracula.prime
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: ef635a010d284bc38d762d2b9f0e65ac
           Boot ID: d2614bc3bd62439088eb7ce519b1923e
  Operating System: Linux Mint 19
            Kernel: Linux 4.15.0-43-generic
      Architecture: x86-64

Check Linux Kernel Using “cat /proc/version”

To check our Linux kernel version, we can use the cat command to check the contents of the /proc/version file:

$ cat /proc/version

CentOS

Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 29 14:49:43 UTC 2018

Debian

Linux version 4.9.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23)

Linux Mint

Linux version 4.15.0-43-generic (buildd@lgw01-amd64-001) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018

Check Linux Kernel Using “uname”

Lastly, we can check our Linux kernel using the uname utility, which is short for unix name.

With it, you can check the name, version, kernel and other details about the current machine and operating system.

To see all the options, just run:

$ uname --help

Output:

Usage: uname [OPTION]...
Print certain system information.  With no OPTION, same as -s.

  -a, --all                print all information, in the following order,
                             except omit -p and -i if unknown:
  -s, --kernel-name        print the kernel name
  -n, --nodename           print the network node hostname
  -r, --kernel-release     print the kernel release
  -v, --kernel-version     print the kernel version
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type (non-portable)
  -i, --hardware-platform  print the hardware platform (non-portable)
  -o, --operating-system   print the operating system
      --help     display this help and exit
      --version  output version information and exit
...

We’ll just use it to check the Linux kernel, in this guide:

$ uname -r

CentOS

3.10.0-957.1.3.el7.x86_64

Debian

4.9.0-4-amd64

Linux Mint

4.15.0-43-generic

Conclusion

In this guide we’ve explored several ways to check our Linux OS name, version, kernel, and other details.

If you’ve encountered any issues or you consider that some aspects of this guide should be corrected, then feel free to contact us via the comments or any other means and we’ll get back to you as soon as possible.


Vlad

Tech Support

LIMITED TIME SPECIAL 💀

Enter your email below to get 20% OFF on any of our Linux VPS plans and receive weekly deals on our services!