determine-os.rst
changeset 1 743f7a15697a
child 735 5c437e2d5fe1
equal deleted inserted replaced
0:0e4335f01909 1:743f7a15697a
       
     1 -*- outline -*-
       
     2 
       
     3 * uname -a
       
     4 
       
     5   $ uname -a
       
     6   Linux poly.tech-recipes.com 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386
       
     7   GNU/Linux
       
     8 
       
     9     kernel name:     Linux
       
    10     hostname:        poly.tech-recipes.com
       
    11     kernel release:  2.6.5-1.358
       
    12     kernel version:  #1 Sat May 8 09:04:50 EDT 2004
       
    13 
       
    14 
       
    15 * Linux
       
    16 
       
    17 ** osinfo command.
       
    18 
       
    19 You can use the osinfo command to determine which distribution you use.
       
    20 
       
    21 ** Version files.
       
    22 
       
    23 See for file `/etc/<distroname>-version' or `/etc/<distroname>-release'.
       
    24 
       
    25   $ cat determine-os.sh
       
    26     #!/bin/sh
       
    27     [ -e /etc/SuSE-release ] && echo This is a SuSE system.
       
    28     [ -e /etc/redhat-release ] && echo This is a redhat system.
       
    29     [ -e /etc/fedora-release ] && echo This is a fedora system.
       
    30     [ -e /etc/debian-version ] && echo This is a debian system.
       
    31     [ -e /etc/slackware-version ] && echo This is a slackware system.
       
    32 
       
    33 See also list:
       
    34   Novell SuSE
       
    35     /etc/SuSE-release
       
    36   Red Hat
       
    37     /etc/redhat-release, /etc/redhat_version
       
    38   Fedora
       
    39     /etc/fedora-release
       
    40   Slackware
       
    41     /etc/slackware-release, /etc/slackware-version
       
    42   Debian
       
    43     /etc/debian_release, /etc/debian_version,
       
    44   Mandrake
       
    45     /etc/mandrake-release
       
    46   Yellow dog
       
    47     /etc/yellowdog-release
       
    48   Sun JDS
       
    49     /etc/sun-release
       
    50   Solaris/Sparc
       
    51     /etc/release
       
    52   Gentoo
       
    53     /etc/gentoo-release
       
    54 
       
    55 ** Kernel version information.
       
    56 
       
    57 Commonly, distributions will leave tags in the kernel version string to identify
       
    58 themselves. This can be found in the log files like /var/log/syslog or /var/log/messages.
       
    59 
       
    60   $ cat /etc/issue
       
    61 
       
    62 or
       
    63 
       
    64   $ cat /proc/version
       
    65 
       
    66 Even if you run a custom kernel, you might still get hints from the gcc version like this
       
    67 one line from /var/log/syslog:
       
    68 
       
    69   Feb 20 05:54:07 sarge kernel: nf3 (root@sarge) (gcc version 3.4.4 20050314 (prerelease)
       
    70   (Debian 3.4.3-13sarge1)) #1 PREEMPT Thu Nov 16 20:31:43 CET 2006