$ 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
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:
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
$ sudo apt-get install lsb-release $ lsb_release -s -i Debian $ lsb_release -s -c squeeze $ lsb_release -s -r 6.0