With so many distributions of Linux out there, and each having its own method of identifying itself, it can get tricky to find out the Linux version you're working on.
You can usually find out most of the information in the /etc/*release or /etc/*version files. If any of those files exist, you can cat them to find out its content -- and to find out which distribution you're running.
Here are a couple of examples.
localhost:~# cat /etc/debian_version 4.0
Red Hat based
[root@vps /]# cat /etc/redhat-release CentOS release 5.2 (Final)
localhost:~# cat /etc/fedora-release ....
Of course you see a trend happening here -- it's always in some "*-release" or "*_version"-file. You can shorten it as follows.
[root@vps /]# cat /etc/*-release CentOS release 5.2 (Final)
That way, you don't have to manually try out every option. You can use a "cat /etc/*_version" look-a-like to identify debian based distributions.
You can find a very complete list of files where to identify your current Linux version, at the LinuxMafia.com website -- release files.
You can also use one of the following tricks, to get your needed data -- should the above one not work.
[root@vps ~]# cat /etc/issue CentOS release 5.2 (Final) Kernel \r on an \m [root@vps ~]# cat /proc/version Linux version 2.6.18-028stab053.17-ent (root@rhel5-32-build) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Mon Jun 9 22:08:38 MSD 2008
And to find out your current kernel, you can use "uname" as follows.
[root@vps ~]# uname -a Linux [servername] 2.6.18-028stab053.17-ent #1 SMP [date] i686 i686 i386 GNU/Linux