diff -r 0e4335f01909 -r 743f7a15697a determine-os.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/determine-os.rst Mon Dec 01 22:51:09 2008 +0200 @@ -0,0 +1,70 @@ +-*- 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/-version' or `/etc/-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