Different ways to get OS version | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Different ways to get OS version

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-18-2011
insvf insvf is offline
Registered User
 
Join Date: Sep 2011
Last Activity: 18 September 2011, 11:47 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Different ways to get OS version

I am trying to figure out the OS version of my Linux box. I got three commands:

Code:
# uname -a
Linux test01     2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64

# cat /proc/version
Linux version 2.6.18-238.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Thu Jan 13 15:51:15 EST 2011

# cat /etc/redhat-release
CentOS release 5.6 (Final)


What are the difference of these three commands?

Last edited by pludi; 09-18-2011 at 05:43 PM..
Sponsored Links
    #2  
Old 09-18-2011
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 1 October 2014, 1:35 PM EDT
Location: Saskatchewan
Posts: 19,480
Thanks: 796
Thanked 3,289 Times in 3,084 Posts
Well, for starters, redhat-release only exists on redhat. it's also only a file, so might lie or be missing.

More distributions have /etc/release but it's not impossible they won't, or be incorrect.

/proc/version is more general but only a Linux thing as far as I know.

uname exists almost everywhere.
Sponsored Links
    #3  
Old 09-18-2011
pludi's Avatar
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,522
Thanks: 38
Thanked 335 Times in 308 Posts
Mainly the amount of information they give you, and the availability.
uname is defined by the POSIX standard and is available on every Unix and Unix-like OS, and gives you information on the OS type, version, and architecture.
/proc/version , as part of the proc pseudo-fs is only available on Linux, and gives you some more detailed information about the kernel, and where and when it was built.

/etc/redhat-release is Red Hat (and derivates) specific, probably not available on any other distribution, and tells you the brand and version of the Linux distribution (not the OS) you're running.
    #4  
Old 09-18-2011
insvf insvf is offline
Registered User
 
Join Date: Sep 2011
Last Activity: 18 September 2011, 11:47 PM EDT
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks above!

I was running the commands on a virtual machine. It is supposed that the VM with CentOS5.6 running on a Linux machine. So with the output of "cat /etc/redhat-release", can I say the VM was set up with right CentOS?
Sponsored Links
    #5  
Old 09-19-2011
rakeshkumar rakeshkumar is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 6 May 2014, 5:25 AM EDT
Posts: 103
Thanks: 35
Thanked 0 Times in 0 Posts
yes !!

FYI :

cat /proc/version :
displays additional information like Name of the user who compiled your kernel, and also a host name where it happened and GCC version used.

the info about the kernel version uname -v , about machine uname -m ..etc.. all can be combined together as #uname -msrnv or #uname -a simply
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
AWK help ! or others ways to do it! geparada88 Shell Programming and Scripting 10 03-31-2011 02:50 AM
10 e-ffective Ways to Get Backlinks! donaldcarter55 What is on Your Mind? 0 04-10-2010 04:37 PM
Ways to know about a command....... g.ashok UNIX for Dummies Questions & Answers 7 11-07-2009 11:15 AM
ways to open a file venkatesht UNIX for Dummies Questions & Answers 3 02-17-2009 05:54 AM
12 Ways to Parse a file google Tips and Tutorials 0 04-06-2005 09:18 AM



All times are GMT -4. The time now is 10:28 AM.