How do I find out what version of Linux distribution I am using from the shell (bash) prompt? How can I tell my Linux distribution name and version?
You can use any one of the following method to find out your Linux distribution and name:
a] /etc/*-release file.
b] lsb_release command
c] /proc/version file.
d] hostnamectl command
Method 1. Use /etc/*-release file to display Linux distro version
To find out what version of Linux (distro) you are running, enter the following cat command at the shell prompt:
$ cat /etc/*-release
Sample output from my RHEL v5.x server:
Red Hat Enterprise Linux Server release 5 (Tikanga)
Sample outputs from my Ubuntu Linux v7.10 server:
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=7.10 DISTRIB_CODENAME=gutsy DISTRIB_DESCRIPTION="Ubuntu 7.10"
Method 2. Use lsb_release command To find out Linux distribution name and version
The lsb_release command displays certain LSB (Linux Standard Base) and distribution-specific information. Type the following command:
$ lsb_release -a
Sample outputs:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 6.0.1 (squeeze) Release: 6.0.1 Codename: squeeze
Method 3. Use hostnamectl to find out my Linux distribution name and version
For GNU systemd based distro this is the best option:
$ hostnamectl

How do I find out My Linux kernel version?
Type the following uname command:
$ uname -a
OR
$ uname -mrs
Sample outputs:
Linux 2.6.32-5-amd64 x86_64
|
Linux 2.6.32-5-amd64 x86_64
Where,
- Linux – Kernel name
- 2.6.32-5-amd64 – Kernel version number
- x86_64 – Machine hardware name (64 bit)
Here is output from my SUSE Enterprise Linux server:

Say hello to /proc/version
Type the following command to see kernel version and gcc version used to build the same:
$ cat /proc/version
Sample outputs:
Linux version 3.2.0-0.bpo.1-amd64 (Debian 3.2.4-1~bpo60+1) (ben@decadent.org.uk) (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Sat Feb 11 08:41:32 UTC 2012
Another outputs from my CentOS 7 box:
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
And SUSE Enterprise Linux server:
Linux version 4.4.162-94.69-default (geeko@buildhost) (gcc version 4.8.5 (SUSE Linux) ) #1 SMP Mon Nov 5 18:58:52 UTC 2018 (9e06c56)
Related media
This tutorial is also available in a quick video format:
Putting It All Together
Conclusion
This page showed various commands to figure out what Linux kernel version and Linux distribution your server/desktop/laptop is running.
(adsbygoogle = window.adsbygoogle || []).push({});