Identifying the OS Distribution

From CodeCodex

Various simple Shell-script checks to try to identify the particular operating system distribution. Currently these are for Linux, feel free to add entries for other *nix systems (e.g. *BSD).

Note these checks are for informational purposes only. If you write code that depends on particular functionality, you should check directly for that functionality, not make assumptions based on trying to identify the OS.

Distro Test
Debian GNU test -d /var/lib/dpkg && echo "This is a Debian system or derivative."
Gentoo Linux test -d /etc/gentoo-release && echo "This is a Gentoo Linux system."
Red Hat Linux test -d /usr/share/rhn && echo "This seems to be a Red Hat Linux system."
SuSE Linux test -d /sbin/conf.d && echo "This is a SuSE Linux system."

Or you can look at the contents of /etc/issue