Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.

"How to know which Linux Distribution i am using ?"

Post #302211858 by nobo on Friday 4th of July 2008 07:24:51 PM


Found this old thread while researching. I come up against this problem often in a very heterogeneous network I admin. Barring us deploying Puppet or a similar solution (someday), I need a fix. There is no canonical way to determine distro so this script is a hack around. It works (gives a best guess) on slack, suse, rh, centOS, ubuntu, solaris, and a couple of other proprietary systems we use.

Comment, suggest, port, test, change, flame. Smilie
#! /bin/bash
# return an awkable string consisting of
#    unix OS type, or
#    Linux dist, or
#    a long guess (based on /proc), or
#    no clue

giveUp () {
   echo "Unknown"
   exit 0

# keep this easily awkable, prepending an initial clue
versionGuess () {
   if [ -e /proc/version ]; then
      echo -n "Unsure "
      cat /proc/version
      exit 0
   return 1

# if we have ignition, print and exit
gotDist () {
   [ -n "$1" ] && echo "$1" && exit 0

# we are only interested in a single word "dist" here
# various malformations can occur; admin will have to code appropately based on output
linuxRelease () {
   if [ -r /etc/lsb-release ]; then
      dist=$(grep 'DISTRIB_ID' /etc/lsb-release | sed 's/DISTRIB_ID=//' | head -1)
      gotDist "$dist"

   dist=$(find /etc/ -maxdepth 1 -name '*release' 2> /dev/null | sed 's/\/etc\///' | sed 's/-release//' | head -1)
   gotDist "$dist"

   dist=$(find /etc/ -maxdepth 1 -name '*version' 2> /dev/null | sed 's/\/etc\///' | sed 's/-version//' | head -1)
   gotDist "$dist"

   return 1

# start with uname and branch the decision from there
dist=$(uname -s 2> /dev/null)
if [ "$dist" = "Linux" ]; then
elif [ -n "$dist" ]; then
   echo "$dist"
   exit 0

# we shouldn't get here
# done

Related Linux and UNIX Technical Support
How to know which Linux Distribution i am using
Hi, I m working on many Linux servers in my project. But i am unable to know which Linux Distribution i am using Like whether i am using SUSE or REDHAT or MONDRAKE. I tried with "uname" command. But it does not help me. Please provide me the command if u know. Regards, Basavaraja KC... UNIX for Dummies Questions & Answers
UNIX for Dummies Questions & Answers
What Linux distribution should I use?
Hey I am right now working on an old Compaq computer, and because I have a newer one I thought of installing Linux on this one. The thing is that I don't know which Linux distribution that would work with a minimum of lag. My computer specifications is: Compaq Presario 7000 Intel Pentium...... UNIX for Dummies Questions & Answers
UNIX for Dummies Questions & Answers
Linux Distribution
Hi, Can anyone please tell me, what is the best Linux distribution for Software Development. Thanks, Philip.... Programming
What was your first Linux distribution?
What was the first Linux distribution you tried? My first was Knoppix, it was pretty good I thought, and it supported my old hardware Too bad I couldn't figure out how to install it at the time though. What about you?... What is on Your Mind?
What is on Your Mind?
DCH-REPEAT(1)						      General Commands Manual						     DCH-REPEAT(1)

dch-repeat - repeats a changelog entry into an older release
dch-repeat --build-tree <PATH> dch-repeat --source-release <RELEASE> dch-repeat --target-release <RELEASE> dch-repeat --devel-release <RELEASE> dch-repeat --pocket <POCKET> dch-repeat -h
dch-repeat is used to repeat a changelog into an older release. It expects that --build-tree is laid out with each Ubuntu release as a separate directory ("feisty", "edgy", etc). For example, if gimp had a security update prepared for Feisty in $TREE/feisty/gimp-2.2.13, running dch-repeat in $TREE/edgy/gimp-2.2.13 would pull in the latest changelog from the Feisty build.
Listed below are the command line options for dch-repeat: -h or --help Display a help message and exit. --build-tree PATH Base of build trees. Default is /scratch/ubuntu/build. -s or --source-release RELEASE Which release to take changelog from. --target-release RELEASE Which release to build into. --devel-release RELEASE Which release is the development release. --pocket POCKET Which pocket to use.
dch-repeat was written by Kees Cook <>. This manual page was written by Jonathan Patrick Davies <>. Both are released under the GNU General Public License, version 2.
dch(1). ubuntu-dev-tools 10 August 2008 DCH-REPEAT(1)

Featured Tech Videos