There are many Linux distributions out there, all with their slight differences. It’s sometimes its hard to determine what distribution you are current using, assuming you weren’t the one who installed it. The commands below can be used to determine the Linux distribution you are using, and in most cases, what version.
# cat /etc/issue.net CentOS release 6.3 (Final) Kernel \r on an \m #
This shows that the distribution is CentOS, and its version 6.3.
This will work for most distributions that show the distribution name and version number at the login prompt.
Another generic check:
$ cat /etc/*release*
# cat /etc/*release* CentOS release 6.3 (Final) CentOS release 6.3 (Final) CentOS release 6.3 (Final) cpe:/o:centos:linux:6:GA #
If you know its a Ubuntu distribution, but aren’t sure what version, you can use the following command:
$ lsb_release -a
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.04.4 LTS Release: 10.04 Codename: lucid $
# cat /etc/centos-release
# cat /etc/centos-release CentOS release 6.3 (Final) #