What terminal command checks the Ubuntu version

For the description and the release number including the OS name, run:

$ lsb_release -d
Description:    Ubuntu 12.04 LTS

Just for the the codename, use:

$ lsb_release -c
Codebase:   precise

For the release number only, use:

$ lsb_release -r
Release:    12.04

For all lsb version details, use:

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:    12.04
Codename:   precise

This should give you what you want:

cat /etc/lsb-release