Show Linux Version

You need to use the following two commands or files:

  1. uname command – Print kernel and system information.
  2. lsb_release command – Show Linux distribution-specific information.
  3. /proc/version file – Get running Linux kernel information.

How to check linux kernel version number?

Open a shell prompt (or a terminal) and type the following command to see your current Linux kernel version:

$ uname -r

Sample outputs:

2.6.32-23-generic-pae

Or type the following command:

$ uname -mrs

Sample outputs:

Linux 2.6.32-23-generic-pae i686

To print all information, enter:

$ uname -a

Sample outputs:

Linux sun 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Where,

  • 5.4.0-105 – Linux kernel version number
  • SMP – Kernel that supports multi core and multiple cpus.

/proc/version file

Type the following command to see Linux version info:

$ cat /proc/version

Sample outputs:

Linux version 5.4.0-105-generic (buildd@lcy02-amd64-066) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04)) #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022

The above output identifies the kernel version that is currently running. It includes the contents of /proc/sys/kernel/ostype, /proc/sys/kernel/osrelease, and /proc/sys/kernel/version files. For example:

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

Sample outputs:

Linux
3.2.0-0.bpo.1-amd64
#1 SMP Sat Feb 11 08:41:32 UTC 2012

Find Distribution Version

Type the following command:

$ cat /etc/*release

OR

$ lsb_release -a

Sample outputs:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 10.04 LTS
Release:	10.04
Codename:	lucid

Here is another output from my Debian based server:

lsb_release -a

Sample outputs:

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