LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to find Linux os version name. (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-linux-os-version-name-947749/)

pradiptart 05-31-2012 07:48 AM

how to find Linux os version name.
 
hello,

I am trying to find out the os version of my redhat system.

i got something like
cat /ete/*release
it is showing the os i have installed but i want the version or os

example:
the above command showing result as
Red Hat Enterprise Linux Server release 5.4 (Tikanga).I want how to get only 5.4 that is only the version of the redhat.

I also got something like uname -r but it is showing the kernel version ,so my doubt is what is the os version?
is this 5.4 or the result of uname -r.

kindly tell any suggestion.

Thanks

acid_kewpie 05-31-2012 08:09 AM

well it depends what your range of input here really is. if you JUST want that value from that file, then you can run "awk '{print $7}' /etc/redhat-release

but those files are totally non-standard across major versions of redhat, let alone distros. a useful tool you can try is facter, which was originally written to support puppet. This will look in all sorts of potential files and locations to return standardized data for things like this. If you install facter, and run "facter lsbmajdistrelease" and you should get a pretty consistent answer on most platforms.

em31amit 05-31-2012 08:34 AM

use lsb_release command to show it .

acid_kewpie 05-31-2012 08:35 AM

Quote:

Originally Posted by em31amit (Post 4691973)
use lsb_release command to show it .

yes, of course... facter uses the lsb package to find that information actually, so ... yes...

em31amit 05-31-2012 08:39 AM

Code:

lsb_release -a
to show detailed information and release version.

pradiptart 05-31-2012 09:47 AM

Thanks all
its really helpful .

bsat 06-01-2012 08:33 AM

cat /etc/issue might also help


All times are GMT -5. The time now is 10:02 PM.