The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > Linux > Slackware
.
google unix.com



Slackware The Official Release of Slackware Linux by Patrick Volkerding is an advanced Linux operating system, designed with the twin goals of ease of use and stability as top priorities.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do I see which version of Linux I am using ? the_learner UNIX for Dummies Questions & Answers 1 04-06-2007 05:11 AM
Determine LOM version? sysera SUN Solaris 2 10-21-2005 08:25 AM
Cmd to determine my OS version? brian.wilson UNIX for Dummies Questions & Answers 2 09-15-2005 09:11 PM
Determine Unix Version davegeysemans UNIX for Dummies Questions & Answers 2 05-24-2005 05:01 AM
Redhat linux version sssow UNIX for Dummies Questions & Answers 3 02-21-2003 03:07 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-07-2005
mbb mbb is offline
Registered User
  
 

Join Date: Aug 2001
Location: UK
Posts: 104
Determine Linux Version.

Apart from the obvious, uname command, is there anyway to determine which Linux distribution and version of the distribution has been installed?
  #2 (permalink)  
Old 12-07-2005
eugrus's Avatar
eugrus eugrus is offline
Registered User
  
 

Join Date: Jan 2005
Location: Russia
Posts: 93
$ cat /proc/version
  #3 (permalink)  
Old 12-07-2005
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
There is no standard way.

Catting /proc/version or uname will only show you information that has been set for compile into the kernel. Only the major distributions will put some special marks for identification, in the form such as custom kernel version tag or gcc version string. But this is not necessarily true especially if the kernel is a self compiled kernel.

For example, here is the /proc/version from my Slackware server:

Code:
user@live:~$ cat /proc/version 
Linux version 2.4.26-local (root@live) (gcc version 3.3.4) #1 SMP Sat Jan 15 09:44:04 HKT 2005
Nothing indicates it's Slackware. Many distributions put its version information in the form of a file in /etc, so you can use that as a heuristic to find out.

For instance, for a few old machines for which I currently have access:

Slackware: /etc/slackware-version
Mandrake: /etc/mandrake-release
Red Hat: /etc/redhat-release
Fedora: /etc/fedora-release
  #4 (permalink)  
Old 12-12-2005
scotbuff scotbuff is offline
Registered User
  
 

Join Date: Jun 2005
Location: Middletown, PA
Posts: 73
SuSE too

This seems to be some sort of standard, all the SuSE versions we have, have the following file also.

cat /etc/SuSE-release

Good to see the other distributions have a similar file.
  #5 (permalink)  
Old 12-12-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Check this post- which machine. The script in that detects your OS version.

Yet another script I found on the net.
Code:
 # Determine the Linux distribution and version that is being run.
   #
   # Check for GNU/Linux distributions
   if [ -f /etc/SuSE-release ]; then
     DISTRIBUTION="suse"
   elif [ -f /etc/UnitedLinux-release ]; then
     DISTRIBUTION="united"
  elif [ -f /etc/debian_version ]; then
    DISTRIBUTION="debian"
  elif [ -f /etc/redhat-release ]; then
    a=`grep -i 'red.*hat.*enterprise.*linux' /etc/redhat-release`
    if test $? = 0; then
      DISTRIBUTION=rhel
    else
      a=`grep -i 'red.*hat.*linux' /etc/redhat-release`
      if test $? = 0; then
        DISTRIBUTION=rh
      else
        a=`grep -i 'cern.*e.*linux' /etc/redhat-release`
        if test $? = 0; then
          DISTRIBUTION=cel
        else
          a=`grep -i 'scientific linux cern' /etc/redhat-release`
          if test $? = 0; then
            DISTRIBUTION=slc
          else
            DISTRIBUTION="unknown"
          fi
        fi
      fi
    fi
  else
    DISTRIBUTION="unknown"
  fi

  ###    VERSION=`rpm -q redhat-release | sed -e 's#redhat[-]release[-]##'`

  case ${DISTRIBUTION} in
  rh|cel|rhel)
      VERSION=`cat /etc/redhat-release | sed -e 's#[^0-9]##g' -e 's#7[0-2]#73#'`
      ;;
  slc)
      VERSION=`cat /etc/redhat-release | sed -e 's#[^0-9]##g' | cut -c1`
      ;;
  debian)
      VERSION=`cat /etc/debian_version`
      if [ ${VERSION} = "testing/unstable" ]; then
          # The debian testing/unstable version must be translated into
          # a numeric version number, but no number makes sense so just
          # remove the version all together.
          VERSION=""
      fi
      ;;
  suse)
      VERSION=`cat /etc/SuSE-release | grep 'VERSION' | sed  -e 's#[^0-9]##g'`
      ;;
  united)
      VERSION=`cat /etc/UnitedLinux-release`
      ;;
  *)
      VERSION='00'
      ;;
  esac;

  echo ${DISTRIBUTION}${VERSION}
  #6 (permalink)  
Old 12-13-2005
mbb mbb is offline
Registered User
  
 

Join Date: Aug 2001
Location: UK
Posts: 104
Thanks all.

Here is another way from my system (but may not always be effective):

>cat /etc/issue
Red Hat Enterprise Linux AS release 3 (Taroon)
Kernel \r on an \m

This is the banner which is displayed for the login getty.
  #7 (permalink)  
Old 12-13-2005
scotbuff scotbuff is offline
Registered User
  
 

Join Date: Jun 2005
Location: Middletown, PA
Posts: 73
Be Careful With /etc/issue

I would not count on /etc/issue. I would venture to guess that possibly you could apply a major update and /etc/issue never changes. The file /etc/issue is sort of like a message of the day type file. On a SuSe machine I updated from 8.2 to 9.1 a year or so ago, that type of file did not update and the login prompt greeted you with an 8.2 banner despite the machine having been updated.

Just something to think about. The release and version files did update in my case but I would say that there is a chance these could be wrong also. But the /etc/issue would be lowest on my list to check.
Sponsored Links
Closed Thread

Bookmarks

Tags
linux, linux mandrake

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0