Most of the times when we say a Linux version then we are referring to the specific Linux distributions…such as Red Hat, SuSe, Debian, Ubuntu etc.
Below are the CLIs that list their distribution specific Linux versions.
On Red Hat Linux Distribution:
# cat /etc/redhat-release
On Novell SuSe Linux Distribution:
# cat /etc/SuSE-release
On Debian Linux Distribution:
# cat /etc/debian_version
On Ubuntu Linux Distribution:
# lsb_release –a
# cat /etc/lsb-release
The contents of these files shouldn’t be changed or altered since different server softwares such as Oracle database refer to those files to decide their own compatibility. Sometimes /etc/issue or /etc/issue.net is also referred for their contents. However, it is not reliable since it is overwritten on some distributions during system boot.
To find exact Linux kernel version installed on the machine, following CLIs can be used…
# uname –a
Linux linux-bk6098 2.6.34.8-0.2-default #1 SMP 2011-04-06 18:11:26 +0200 i686 i686 i386 GNU/Linux
# cat /proc/version
Linux version 2.6.34.8-0.2-default (geeko@buildhost) (gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux) ) #1 SMP 2011-04-06 18:11:26 +0200
If you know any Linux distribution that differs from above CLI for determining their version then do post your comments below.

Thanks for sharing a nice info..
ReplyDeleteGanesan K