Well you can try “uname -a”. That always works for Solaris, Sun and HP-UX. For Linux, it is a slightly different matter.
Using the same command, all it returns is
Linux ubuntu 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux
Not very informative. Try this instead “cat /etc/*release”
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.04
DISTRIB_CODENAME=feisty
DISTRIB_DESCRIPTION=”Ubuntu 7.04″
Use with uname, it gives all the info you need.
For more Linux related posts see here.