![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is your favorite Linux distro? | milhan | Linux | 128 | 6 Days Ago 08:28 AM |
| help newb at linux and bash need numeric script sort | dlm1065 | Shell Programming and Scripting | 1 | 04-27-2008 04:11 AM |
| Copying a Linux distro from one partition to the other... | Mr_Proper | UNIX for Advanced & Expert Users | 5 | 06-18-2003 01:38 PM |
| Linux distro | wolk | UNIX for Dummies Questions & Answers | 4 | 11-29-2002 08:29 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Linux distro from bash script
hello ALL,
I wander, is there an easy way to get information which linux distro and its version a script runs on? I'm looking for a function like getDistroInfo(), which would return strings like "Ubuntu7.10" or "SLES10" or "RHEL5" etc. uname returns lots of stuff, but distro info. /etc/issue has different formats depending on distro (which is not really convenient if you don't know the distro). Does anybody have an idea? Thanx! Alex |
|
||||
|
Alex, what you really want to look at is the file /etc/*-release. It has several lines describing the current Linux distro that your running (see release-files for the various distro's version of this file)
The file contains several lines containing various parts of the Name - in my case I run Ubuntu and my file is named /etc/lsb-release and contains the following 4 lines - DISTRIB_ID=Ubuntu DISTRIB_RELEASE=8.04 DISTRIB_CODENAME=hardy DISTRIB_DESCRIPTION="Ubuntu 8.04.1" the DISTRIB info should be pretty consistent across the many variants |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|