determine-os.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 01 Dec 2008 22:51:09 +0200
changeset 1 743f7a15697a
child 735 5c437e2d5fe1
permissions -rw-r--r--
Move admin doc from utils proj.

-*- outline -*-

* uname -a

  $ uname -a
  Linux poly.tech-recipes.com 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386
  GNU/Linux

    kernel name:     Linux
    hostname:        poly.tech-recipes.com
    kernel release:  2.6.5-1.358
    kernel version:  #1 Sat May 8 09:04:50 EDT 2004


* Linux

** osinfo command.

You can use the osinfo command to determine which distribution you use.

** Version files.

See for file `/etc/<distroname>-version' or `/etc/<distroname>-release'.

  $ cat determine-os.sh
    #!/bin/sh
    [ -e /etc/SuSE-release ] && echo This is a SuSE system.
    [ -e /etc/redhat-release ] && echo This is a redhat system.
    [ -e /etc/fedora-release ] && echo This is a fedora system.
    [ -e /etc/debian-version ] && echo This is a debian system.
    [ -e /etc/slackware-version ] && echo This is a slackware system.

See also list:
  Novell SuSE
    /etc/SuSE-release
  Red Hat
    /etc/redhat-release, /etc/redhat_version
  Fedora
    /etc/fedora-release
  Slackware
    /etc/slackware-release, /etc/slackware-version
  Debian
    /etc/debian_release, /etc/debian_version,
  Mandrake
    /etc/mandrake-release
  Yellow dog
    /etc/yellowdog-release
  Sun JDS
    /etc/sun-release
  Solaris/Sparc
    /etc/release
  Gentoo
    /etc/gentoo-release

** Kernel version information.

Commonly, distributions will leave tags in the kernel version string to identify
themselves. This can be found in the log files like /var/log/syslog or /var/log/messages.

  $ cat /etc/issue

or

  $ cat /proc/version

Even if you run a custom kernel, you might still get hints from the gcc version like this
one line from /var/log/syslog:

  Feb 20 05:54:07 sarge kernel: nf3 (root@sarge) (gcc version 3.4.4 20050314 (prerelease)
  (Debian 3.4.3-13sarge1)) #1 PREEMPT Thu Nov 16 20:31:43 CET 2006