To find the OS version on an already-installed box:

/etc/os-release

It's a newer standard.

Linux

First do uname -a or dmesg | less to find out what general distribution is installed. Then, look in the right release file:

ls -ld /etc/*release /etc/*version /etc/*issue

distro /etc/release equivalent info for each version
Ubuntu /etc/issue
/etc/lsb-release
[versions]
Debian /etc/debian_version [versions]
Redhat /etc/redhat-release [versions]
Knoppix /etc/knoppix-version [versions]
SuSE /etc/SuSE-release
others one, two  

Other un*xes

Solaris /etc/release
AIX `oslevel`
HP UX `uname -r`

MS-DOS

Run ver.

Alternatively, run:

strings command.com | grep -i version

and you'll see a line that looks like "MS-DOS 7.1 [Version %1]"