Linux – Determine the OS version of an OEL linux box

linuxoperating systemredhat

The usual methods to determine the OS versions seem to be viewing

/etc/*-release file 

*here would be the family to which the particular version of the OS belongs to. But on the OEL system, the following files are present and all of them seem to be returning valid release versions, in such situations is there a definite method of determining the OS release version details :

 cat /etc/redhat-release
 Red Hat Enterprise Linux Server release 5.8 (Tikanga)

  cat /etc/enterprise-release
  Enterprise Linux Enterprise Linux Server release 5.8 (Carthage)

  cat /etc/oracle-release
  Oracle Linux Server release 5.8

cat /etc/*release*
Enterprise Linux Enterprise Linux Server release 5.8 (Carthage)
Oracle Linux Server release 5.8
Red Hat Enterprise Linux Server release 5.8 (Tikanga)

using alternatives as mentioned below are used only in case the above files don't return
valid values :

lsb_release -a returns the same output as returned by enterprise-release 

Update 1 : context of execution

The /etc/*-release file is examined as a part of a programmatic solution, the value of * is provided by a dummy file which can have these values :

asianux,enterprise,mandrake,redhat,UnitedLinux,Suse,SuSE

depending on the order of appearance in the above scenario since enterprise appears first /etc/enterprise-release file is queried to find the OS version
In case the ordering was otherwise with redhat appearing before enterprise /etc/redhat-release would be used.

This does not seem to be a viable solution hence seeking other more definite methods for determining the version of the OS.

Best Answer

lsb_release -a

See Linux Standard Base documentation

As per your question you mention this as an alternative in case the above do not work. You should use lsb_release first as it is the standard.

Also it should return more information than the enterprise-release command, specifically the LSB Version line (eg, lsb_release -v)