Red hat linux you are running

How to Check Linux Red Hat (RHEL) Version Installed On Your System

Red Hat is a popular and influential fork of the Linux operating system. It has been around since the mid-1990s and has earned a reputation for being stable, reliable, and regularly updated. There are many Linux operating systems based on Red Hat architecture, such as RHEL, CentOS and Fedora.

Finding your Red Hat version is straightforward. This tutorial shows you five ways to check the version of Red Hat Enterprise Linux (RHEL).

how to check linux redhat version

  • A system running RHEL, CentOS, or another Red-Hat-based Linux distribution
  • A terminal window/command line (Ctrl-Alt-F2)

5 Ways to Find Version of Red Hat Linux (RHEL)

Option 1: Use hostnamectl

The hostnamectl command is usually used to track the way your system appears on a network. However, it also includes information such as the OS and version, making it a quick and handy way to check these specifics.

Open a terminal window and enter the following:

check red hat version with hostnamectl1

The fields you are interested in are:

  • Operating System: This tells you which Linux fork you are using, and which major release.
  • Kernel: This is the version of the Linux kernel your operating system is using.
  • Architecture: This tells you whether you are running a 32-bit or 64-bit operating system, which is essential when choosing a software package to install.

Option 2: Find Version in /etc/redhat-release File

Red Hat-based distros contain release files located in the /etc/redhat-release directory.

For example, os-release, system-release, and redhat-release.

To check each file for your Red Hat OS version use the command:

check red hat version in release file

In the image above, you can see that this system is using the version CentOS 7.6.1810.

Option 3: Check Query Release Package with RPM

Alternatively, you can use the rpm command to query Red Hat’s release package.

Enter the following command:

Specifically, use the command that is appropriate for your version of Linux (RHEL or CentOS distribution).

check query release package with rpm

Expect more details than when using hostnamectl .

Читайте также:  Linux at job scheduler

Option 4: Finding Red Hat Version and Release Using /etc/issue File

You can check the Red Hat version within the /etc/issue file.

Option 5: Check Common Platform Enumeration File

Check the CPE file for your Red Hat version by entering:

The system should return a full name and version of your operating system.

Check Other Release Files

Your Linux operating system keeps a set of release files in the /etc/ directory.

List the file names of release versions by typing the following command:

Each of the entries listed holds information about your Red Hat version.

Use the cat (concatenate) command to list the contents of the files:

other release files in RHEL

You can substitute the names of the files displayed on your system for the redhat-release file in the example above.

Discussion on Red Hat Versions

At the moment, RHEL (Red Hat Enterprise Linux), and CentOS are two of the most popular versions of Red Hat Linux.

The Red Hat version is different from the Linux Kernel version. The Linux Kernel is like the central brain of the Linux operating system and can be updated independently of the operating system. The Operating System version is the release version number of the whole OS package.

You may see a Red Hat version number like Red Hat 7.3. The number 7 refers to a major release, much like “Windows 7” and “Windows 10.” The number following the dot refers to the level of patches and minor updates. So Red Hat 7.3 is Red Hat version 7, patched and updated to 7.3.

After reading this article, you will know how to check or find your Red Hat operating system version in a number of ways.

Finally, for more information about the Red Hat family of Linux, please see the official Red Hat documentation.

Источник

Determine Redhat Linux Version

If I am running redhat 5.1 and someone upgrade it with 5.2 or 5.x, what determines the version of RedHat?

even lsb_release -a read /etc/redhat-release file.

This isn’t a tricky question. RedHat puts the version in /etc/redhat-release . If people tamper with that file, you’re a bad sysadmin because in reality no one should be able to change that file except for root.

Why do you want to know what version of RedHat is running? What determines the version depends on why you want to know. (For example, if you want to know what it will report as its version, then you do want to look in /etc/redhat-release . If you want to know if it’s running the latest kernel in its release stream, then you do want the kernel version.)

Читайте также:  Linux отключить вывод ошибок

Giving someone root access to a machine is like giving them keys to your house or something. Wouldn’t you only give your house keys to those you trusted? Why can’t you trust people to whom you’ve given root access with the contents of /etc/redhat-release ? If you can’t, then you also can’t be sure that running ls won’t run rm -rf ~/* .

9 Answers 9

for instance on my machine I get this

If «anybody» has root access to your machine to either change /etc/redhat-release or install an alternate kernel you’re most probably in bigger trouble than determining the redhat version of your system.

Just use the value pointed out by /etc/redhat-release or even better in terms of portability use the output of lsb_release as this is exactly the purpose they were made for.

With «anybody» being able to do anything with your system there is no other chance at all.

@Satish, the essence of this answer, and everyone else’s comments, is that you should trust (or at least be able to trust) the /etc/redhat-release file contents and lsb_release . If you argue that those outputs are untrustworthy since «anybody can tamper with that file», then your entire system is untrustworthy because editing that file requires root access to the system (and if someone changed that file to be wrong, who’s to say they didn’t do something else bad?). Either you trust that it’s right, or you need to rethink your system’s security if you can’t trust those with root access.

@Satish: affarmitive but it will read /wherever/whatever_file or run /wherever/whatever_program an any LSB compliant system, that’s what I meant by better «portability»

You can use the lsb_release command on recent linux distributions. If you issue:

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).

Note: since July 2012, /etc/os-release should be the standard file where to look for the version of any OS.

  • It relieves application developers who just want to know the distribution they are running on to check for a multitude of individual release files.
  • It provides both a «pretty» name (i.e. one to show to the user), and machine parsable version/OS identifiers (i.e. for use in build systems).
  • It is extensible, can easily learn new fields if needed.
# cat /etc/os-release NAME="Red Hat Enterprise Linux Server" VERSION="7.0 (Maipo)" ID="rhel" ID_LIKE="fedora" VERSION_ID="7.0" PRETTY_NAME="Red Hat Enterprise Linux Server 7.0 (Maipo)" 

Unfortunately this doesn’t seem to work with rhel 6.x, even not with the latest patches installed. This file does not exist for that release, and probably not for older ones.

Читайте также:  Linux root mount options

A trick working on numerous Linux distributions:

Example on Red Hat 6:

$ cat /etc/issue CentOS release 6.7 (Final) Kernel \r on an \m $ 

The most simple command is:

for recent linux machines

For folks who are reading this today, or in the future:
The kernel version that is RUNNING is your version of RedHat. There may be other versions installed, but not running.
Thus, if RedHat 5.1, 5.2 & 5.x are installed on the machine, only 1 can be running at a time. This is the version that was booted at system start uop.To determine which version is actually running, use the uname command:
uname -r
This returns the Kernel release number. For RedHat 5, it will be 2.6.18-[something]
RH 5.1 is 2.6.18-53
RH 5.2 is 2.6.18-92

To translate kernel release numbers into Redhat Version numbers, see this link:
Red Hat Enterprise Linux Release Dates

The file /etc/redhat-release is standart way to get vendor version (including 5.X). I don’t think you should ignore this way. Of course, you can use various tricks from other software to display the current version of OS, but anyway many of them are parsing the /etc files. As mentioned above you can use rpm query to get version. Another way to get such information: rpm -q -release

BTW I agree with the commenters above that the way you knowing the version is the least of your problems if anyone can tamper with the standard /etc/redhat-release file or other system configuration files.

Additionally since RHEL 7.X versions you can also try hostnamectl | grep ‘Operating System’

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Оцените статью
Adblock
detector