determine-os.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 05 Aug 2015 23:55:34 +0300
changeset 1729 22ffd80639c0
parent 899 7b4265c8d324
permissions -rw-r--r--
Make centered content design with adoption for mobile devices. Highlight TOC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
899
7b4265c8d324 Set fill-column as directory local var.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 848
diff changeset
     1
-*- mode: outline; coding: utf-8; -*-
1
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
* uname -a
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
  $ uname -a
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
  Linux poly.tech-recipes.com 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
  GNU/Linux
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
    kernel name:     Linux
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
    hostname:        poly.tech-recipes.com
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
    kernel release:  2.6.5-1.358
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
    kernel version:  #1 Sat May 8 09:04:50 EDT 2004
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
* Linux
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
** Version files.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
See for file `/etc/<distroname>-version' or `/etc/<distroname>-release'.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
  $ cat determine-os.sh
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
    #!/bin/sh
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
    [ -e /etc/SuSE-release ] && echo This is a SuSE system.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
    [ -e /etc/redhat-release ] && echo This is a redhat system.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
    [ -e /etc/fedora-release ] && echo This is a fedora system.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
    [ -e /etc/debian-version ] && echo This is a debian system.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
    [ -e /etc/slackware-version ] && echo This is a slackware system.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
See also list:
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  Novell SuSE
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
    /etc/SuSE-release
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
  Red Hat
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
    /etc/redhat-release, /etc/redhat_version
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
  Fedora
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
    /etc/fedora-release
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
  Slackware
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
    /etc/slackware-release, /etc/slackware-version
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
  Debian
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
    /etc/debian_release, /etc/debian_version,
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  Mandrake
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
    /etc/mandrake-release
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
  Yellow dog
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
    /etc/yellowdog-release
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
  Sun JDS
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
    /etc/sun-release
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
  Solaris/Sparc
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
    /etc/release
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
  Gentoo
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
    /etc/gentoo-release
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
** Kernel version information.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
Commonly, distributions will leave tags in the kernel version string to identify
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
themselves. This can be found in the log files like /var/log/syslog or /var/log/messages.
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
  $ cat /etc/issue
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
or
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
  $ cat /proc/version
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
Even if you run a custom kernel, you might still get hints from the gcc version like this
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
one line from /var/log/syslog:
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
  Feb 20 05:54:07 sarge kernel: nf3 (root@sarge) (gcc version 3.4.4 20050314 (prerelease)
743f7a15697a Move admin doc from utils proj.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
  (Debian 3.4.3-13sarge1)) #1 PREEMPT Thu Nov 16 20:31:43 CET 2006
848
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    67
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    68
** 'lsb_release' command.
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    69
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    70
  $ sudo apt-get install lsb-release
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    71
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    72
  $ lsb_release -s -i
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    73
Debian
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    74
  $ lsb_release -s -c
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    75
squeeze
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    76
  $ lsb_release -s -r
036b1658338c 'lsb_release' command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 735
diff changeset
    77
6.0