If you need to know only your OS version's name, use /etc/os-release file:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
There exists /usr/share/distro-info/ubuntu.csv file, which you can parse via text processing utilities , such as AWK , grep, python, perl , or any other.
Actually, there is a command ubuntu-distro-info. It is not installed by default but you can obtain it via sudo apt-get install distro-info. The command itself is a shell script, and relies on the mentioned ubuntu.csv file. So if you don't want to think too hard and write scripts yourself , use that:
$ ubuntu-distro-info --all -f
Ubuntu 4.10 "Warty Warthog"
Ubuntu 5.04 "Hoary Hedgehog"
Ubuntu 5.10 "Breezy Badger"
Ubuntu 6.06 LTS "Dapper Drake"
Ubuntu 6.10 "Edgy Eft"
Ubuntu 7.04 "Feisty Fawn"
Ubuntu 7.10 "Gutsy Gibbon"
Ubuntu 8.04 LTS "Hardy Heron"
Ubuntu 8.10 "Intrepid Ibex"
Ubuntu 9.04 "Jaunty Jackalope"
Ubuntu 9.10 "Karmic Koala"
Ubuntu 10.04 LTS "Lucid Lynx"
Ubuntu 10.10 "Maverick Meerkat"
Ubuntu 11.04 "Natty Narwhal"
Ubuntu 11.10 "Oneiric Ocelot"
Ubuntu 12.04 LTS "Precise Pangolin"
Ubuntu 12.10 "Quantal Quetzal"
Ubuntu 13.04 "Raring Ringtail"
Ubuntu 13.10 "Saucy Salamander"
Ubuntu 14.04 LTS "Trusty Tahr"
Ubuntu 14.10 "Utopic Unicorn"
Ubuntu 15.04 "Vivid Vervet"
Ubuntu 15.10 "Wily Werewolf"
Ubuntu 16.04 LTS "Xenial Xerus"
Ubuntu 16.10 "Yakkety Yak"
Ubuntu 17.04 "Zesty Zapus"
It has many other command-line flags, like -y for checking how many days are left until next milestone, be it reaching release stage or End-of-Life status. For example, this: distro-info --all -f -y"eol"
will tell you negative values for those that have reached End of Life status and positive for those that haven't.