LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on...

Notices

Reply
 
LinkBack Search this Thread
Old 01-23-2013, 08:25 AM   #1
ghostware
LQ Newbie
 
Registered: Jan 2013
Location: Alexandria, VA
Distribution: multiple
Posts: 3

Rep: Reputation: 0
Question Determine version of Linux?


Old school UNIX programmer now needing to deal with a lot of Linux versions (RedHat, SUSE, etc) on machines without documentation. Trying to label various machines distributions and only having marginal success, Tried old reliable uname command but Linux distributions are a lot more complicated and do not believe all information is captured I need is here and need more methods to distinguish versions.

As an example using uname command:

uname-s:Linux
uname-r:2.6.9-89.ELsmp
uname-v:#1 SMP Mon Apr 20 10:34:33 EDT 2009
uname-m:i686
uname-p:i686
uname-i:i386

No where in this does it tell me that this is a Red Hat system, something I am fairly sure it is. I think it is a version of Red Hat 5 and when I did a search I found these three systems matching kernel:
  • RedHatEnterpriseAS 4
  • RedHatEnterpriseWS 4
  • RedHatEnterpriseServer 5.2

Any programmatic way of further determining version? Pretty sure dealing with 8-10 versions of Red Hat, SUSE, Oracle Linux, etc and want to further distinguish them so can write adjustments to scripts appropriately.
 
Old 01-23-2013, 08:29 AM   #2
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 113

Rep: Reputation: 25
If it is Red Hat, check /etc/redhat-release

Code:
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.9 (Tikanga)
Other distributions may have a similar file, such as /etc/SuSE-release, or /etc/lsb-release

Last edited by thesnow; 01-23-2013 at 08:32 AM. Reason: upd
 
Old 01-23-2013, 09:32 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,534
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
See rkh_dat_get_os_info()?
 
Old 01-23-2013, 09:23 PM   #4
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, Mint
Posts: 6,888

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
Either of these commands

Code:
cat /etc/*version*
cat /etc/*release*
will work on most distros.
 
Old 01-24-2013, 07:23 PM   #5
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 119

Rep: Reputation: 27
Some distros are starting to use file /etc/os-release
Slackware v 14.0 now has the file and I think newer fedoras and red hats, some variables are suppose to match between distros. Slackware's version:
Quote:
NAME=Slackware
VERSION="14.0"
ID=slackware
VERSION_ID=14.0
PRETTY_NAME="Slackware 14.0"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:slackware:slackware_linux:14.0"
HOME_URL="http://slackware.com/"
SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
So maybe check for /etc/os-release and if not found try the other methods described in this thread

John
 
Old 01-25-2013, 03:31 PM   #6
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 167

Rep: Reputation: 35
Code:
cat /etc/issue
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I determine what version of Linux is running? DStrick64 Linux - Newbie 17 05-30-2012 09:29 AM
how do i determine the version of linux that my synology server is running? lesschow Linux - Newbie 3 07-07-2011 07:09 PM
How do I determine the Linux Server Version using a console (puTTY)? adichosa Linux - Newbie 3 10-25-2008 09:39 AM
How to determine version of linux djburdick Linux - General 2 04-24-2006 10:37 AM
Determine version of Linux OS? amiableboy Linux - Newbie 2 07-21-2005 04:16 AM


All times are GMT -5. The time now is 12:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration