How To Check, Show and Print Linux Version with Commands?

Linux is the kernel and there are a lot of distributions those use kernel. Distributions provide different experience and flavors to the users. Some times getting distribution and version information from a Linux box became very important. We will look at how to get Linux kernel and distribution from the Linux system.

Kernel Information

Kernel information can get with uname command which is by default exists all Linux, Unix, BSD operating systems.

$ uname
Kernel Information

Without any parameter, uname will list the current operating system which is Linux. As we can see this a Ubuntu operating system with kernel version 4.10.0-27  with hostname poftut

Print Kernel Version

If we only need the kernel version of the current Linux system we should use -r parameter with uname command.

$ uname  -r
Print Kernel Version

In this case our kernel version is 4.10.0-37-generic.

Distribution Information

Distribution information can be get different way. Getting distribution information changes from distribution to distribution but there are some common ways to use.

$ cat /proc/version

Proc Filesystem

We can use the proc file  system to get ostype,osrelease and version information.

$ cat /proc/sys/kernel/{ostype,osrelease,version}

Release File

Most of the Linux distributions like Ubuntu,  Debian, Mint, Kali, Fedora, CentOS, RHEL uses release config files to hold detailed release information.These files are stored in /etc/ with different names those ends with  release  term. We can print this information with cat command like below for all Linux distributions.

$ cat /etc/*release
Release File


Ubuntu and Debian way getting distribution information. This command can not be run on CentOS

$ lsb_release -a

We will get the following information about our Linux system

  • Distribution is `Ubuntu`
  • Distribution version or release is `17.04`
  • Codename is `zesty`
LEARN MORE  What Is Unix?

Leave a Comment