How can I determine from the shell with no privileges what the Red Hat Enterprise Linux version is, for example is it RHEL 4 or RHEL 5.1?
|
You can use the lsb_release command on recent linux distributions. If you issue:
it will tell you the Distribution and Version. This is a little bit more accurate than accessing files that may or may not have been modified by the admin or a software package. As well as working across multiple distros. |
|||
|
You can look at the contents of /etc/redhat-release, which will look something like this:
The contents are different for an actual RHEL system. This technique works on all RedHat derivatives, including CentOS, Fedora, and others. |
|||
|
|
|
I prefer to use the /etc/issue file.
I've seen many situations where /etc/redhat-release has been modified to meet software compatibility requirements (Dell or HP's management agents, for instance). |
|||
|
|
|
Assuming it truly is a Red Hat release (not Centos):
Or just run:
And map the output. 2.6.9 kernels are RHEL4, 2.6.18 kernels are RHEL5. If necessary, you can map the full version to the specific update releases from Red Hat (i.e. 2.6.9-89 is RHEL5 U4). |
|||
|
|
|
If you have RHEL, this will work (verified on RHEL 5.5):
This will also work on CentOS. Edit: This tool is included in the package "redhat-lsb", you need to have this installed:
|
|||
|
|
|
A really stupid way is to look at the GRUB menu which usually includes such information :
This not the smartest way to do such a thing but will work on any distribution / UNIX that uses GRUB. |
|||
|
|