The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to know which Linux Distribution i am using ? BasavarajaKC Shell Programming and Scripting 5 07-04-2008 04:24 PM
What Linux distribution should I use? Sixmax UNIX for Dummies Questions & Answers 7 05-27-2008 10:27 PM
How to obtain system open file table value in Linux mahesh. Shell Programming and Scripting 0 05-25-2007 07:25 AM
How to know which Linux Distribution i am using BasavarajaKC UNIX for Dummies Questions & Answers 3 06-02-2006 05:00 AM
IP details for Unix/Linux login clients? ghoti UNIX for Dummies Questions & Answers 15 09-19-2001 08:04 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 06-30-2008
Sivaswami's Avatar
Registered User
 

Join Date: Mar 2007
Location: India
Posts: 58
How to obtain the Linux Distribution Details ?

Hi,

I am working on a Unix console.
I want to obtain the Linux distribution details in
1) Shell
2) C program ( System call )
Want to know if it is REDHAT / SUSE / UBUNTU , etc ..

Please let me know if there is any way to achieve this.

Thanks in advance,
Siva.
Reply With Quote
Forum Sponsor
  #2  
Old 06-30-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,200
With the uname command? Read the man page of uname.

Regards
Reply With Quote
  #3  
Old 06-30-2008
Sivaswami's Avatar
Registered User
 

Join Date: Mar 2007
Location: India
Posts: 58
with uname command I can get only
Linux <kernel version> <time>
not the distribution details.

How ever referring to some manuals i received that /proc/version
gives the distribution details.

But not sure about the system call which helps to obtain these details
( details obtained from /proc ) into the C program. any help on this ?
Reply With Quote
  #4  
Old 06-30-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,200
You can open and read it as a regular file and parse the desired fields in your program.
An alternative is to use popen and print the desired fields with cut or with awk.

Regards
Reply With Quote
  #5  
Old 06-30-2008
Registered User
 

Join Date: Jun 2006
Posts: 49
Not sure if this helps, but cat /etc/issue. That will usually show the human readable version.
Reply With Quote
  #6  
Old 07-02-2008
Registered User
 

Join Date: Jul 2008
Posts: 2
Find Linux distribution release information

if file /etc/SuSE-release exists
It is a SuSE and it contains the version information

if file /etc/redhat-release exists
It is a RedHat box and contains the version information

I am not sure how to do that on Ubuntu other than /etc/issue. I don't think Ubuntu comes with /etc/ubuntu-release file.

-Aby


Quote:
Originally Posted by Sivaswami View Post
Hi,

I am working on a Unix console.
I want to obtain the Linux distribution details in
1) Shell
2) C program ( System call )
Want to know if it is REDHAT / SUSE / UBUNTU , etc ..

Please let me know if there is any way to achieve this.

Thanks in advance,
Siva.
Reply With Quote
  #7  
Old 07-14-2008
Sivaswami's Avatar
Registered User
 

Join Date: Mar 2007
Location: India
Posts: 58
Hi All,

Thx for the information.
1) In few Linux machines uname -a fails to give the details of Linux Distribution ( eg: Ubuntu)
2) I think any one can alter the /etc/issue file and is not safe to access it always.

I digged more and found this.
cat /proc/version
it output same info as uname -a , but with additional info on the Linux Distribution.

Thx,
Siva.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux, solaris, ubuntu

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0