Jump to content

determining the distribution


Recommended Posts

what's the best way to determine the distribution of a linux system?

 

i'm posting the question in this forum because i need to be able to do it in a bash script.

 

while i'm at it, what's the easiest way to determine a version of a specific service? I.E. statd, mountd, and the like. (or any program for that matter)

 

assume that RPMs may or may not be the process by which the programs where installed.

 

 

thanks for any help :)

Link to comment
Share on other sites

if you want the distribution name (or release name) on a mandrake then:

[arusabal@localhost ~]$ cat /etc/mandrake-release 

Mandrake Linux release 8.1 (Vitamin) para XXXX (i586)

or simply do 'cat /etc/issue'

 

In both cases you'll get the name of the mandrake release, which is pretty useless. What is important is what paul said ('/proc/version' or 'uname') because there you'll get the kernel version, the compiler used... which is what really matters.

 

I don't think there is a standard file where to put the name of a distro (even there is no need to do it at all). That just depends on the people who made the distro (IMHO).

 

while i'm at it, what's the easiest way to determine a version of a specific service? I.E. statd, mountd, and the like. (or any program for that matter)

 

Looking at the man page of each command/program/daemon, you can check which parameter is used to return the version of the program (usually -v or -V).

 

other useful hints are:

rpm -qa | grep package_name

Will let you know the rpm version of the package (which is normaly related to the version of the software it provides).

To get a deeper detailed info, do:

rpm -qi package_name

Link to comment
Share on other sites

In both cases you'll get the name of the mandrake release, which is pretty useless. What is important is what paul said ('/proc/version' or 'uname') because there you'll get the kernel version, the compiler used... which is what really matters.

 

i'm actually going to be looking for what distribution of Linux it is, Red Hat, Mandrake, etc. and what version of that distro it is. this is all tied into bash scripts that are going to be used for checking for programs w/security holes. but, i got all the info i need at this point, so thanks!

Link to comment
Share on other sites

I don't know if you already know this, but as it has been my last bash-discovery, here it goes:

---> at least this works for bash:

In my Mdk box:

 [arusabal@mdkhost ~]$ echo $MACHTYPE 

i586-mandrake-linux-gnu

 

and in my Slackware box:

 [arusabal@slackhost ~]$ echo $MACHTYPE 

i386-slackware-linux-gnu

 

... now I have to find out where does bash get that info...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...