How to confirm RedHat Enterprise Linux version?
I assume that you've run yum upgrade. That will in general update you to the newest minor release.
Your main resources for determining the version are /etc/redhat_release
and lsb_release -a
Determine Redhat Linux Version
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.
Get a specific Redhat version with regard to Kernel version
RHEL stands for Red Hat Enterprise Linux.
you can get the version and kernel details by uname command like the below example:
[hatem@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
if you want to know what is the distribution is:
[hatem@localhost ~]$ cat /etc/issue
Red Hat Enterprise Linux Server release 6.5 (Santiago)
check if my OS release is CentOS or not
Check out /etc/issue
to get additional branding/OS issue on RedHat based operating systems. This has been buggy in the past, so you can additionally check rpm -q centos-release
or /etc/os-release
.
Note that /etc/issue
is meant to be read by the tty, so check out man agetty
if you see lines like \S
or Kernel \r on an \m
and want to know what that means.
Santiago just is a release name for RHEL 6.2.
Finally, for even more information, check out lsb_release -a
and you'll see lines for Distributor ID
, and Description
.
Linux version check Linux command or a Java code
Have you tried with?
cat /etc/*-release
cat /etc/redhat-release
or
cat /etc/issue
or
cat /proc/version
or even with
uname -a
Looking at Java documentation I see you can get few basic information about the operating system via System.getProperty(), I suppose you use Java Standard Edition 6.0. But very likely also other versions should return same infos.
- os.name Operating system name
- os.arch Operating system architecture
- os.version Operating system version
rhel os version detecting in makefile
In Makefiles, I prefer readability first, than performance or complex codes. Your version of code seems simple and fine. Just that multiple cut commands in your version, could be reduced into a single awk, as below.
OSVERSION = cat /etc/redhat-release | awk 'NF>1{print $NF}'
ifeq(OSVERSION,4)
XXXXXXXXXXX
else
YYYYYYYYYYY
endif
Besides, I would also like to point out that, /etc/redhat-release
file is a reliable source of OS versions. But other commands do exist that do the similar:
$ uname -a
Linux local.net 3.5.3-1.fc17.i686 #1 SMP Wed Aug 22 18:25:58 UTC 2013 i686 i686 i386
GNU/Linux
$ cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
$ /usr/bin/lsb_release --d
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
How to check java version at linux (RedHat6)
To answer your question directly, you can use
rpm -qi java
OR
yum info "java"
For future Referenecs . You can try any of these commands.
rpm -qi "package_name_without_quotes"
It gives information of installed package. To display information about one or more packages (glob expressions are valid here as well), use the following command :
yum info "package_name_without quotes"
OR
yum list "package_name_without_quotes"
OR
yum --showduplicates list "package_name_without_quotes"
The yum info package_name command is similar to the rpm -q --info package_name command, but provides as additional information the ID of the Yum repository the RPM package is found in.
You can also query the Yum database for alternative and useful information about a package by using the following command :
yumdb info "package_name_without_quotes"
This command provides additional information about a package, including the check sum of the package (and algorithm used to produce it, such as SHA-256), the command given on the command line that was invoked to install the package (if any), and the reason that the package is installed on the system.
Related Topics
How to Know the Interrupt/Gpio Number for a Specific Pin in Linux
How to Find My Shell Version Using a Linux Command
Get Current Time in Hours and Minutes
Unix Command to List Files Containing String But *Not* Containing Another String
How to Compare Two Tarball's Content
Changing Name of the Video While Downloading via Youtube-Dl
Linux: Screen Desktop Video Capture Over Network, and Vnc Framerate
Id_Rsa.Pub File Ssh Error: Invalid Format
Gcc Verbose Mode Output Explanation
How to Fix Symbol Lookup Error: Undefined Symbol Errors in a Cluster Environment
How to Check Internet Access Using a Bash Script on Linux
How to Check That Two Folders Are the Same in Linux
How to Copy All PDF Files from a Directory and Its Subdirectories to One Location