How to get version of magento 2
[1] Via Code
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface');
$version = $productMetadata->getVersion(); //will return the magento version
[2] Go to CLI, Locate your Magento Root Folder & Run below command
php bin/magento --version
Output
Magento CLI version 2.1.1
Which print your Current Magento Version
[3] If you open composer.json
on Magento Root You can find as well
"require": {
"magento/product-community-edition": "2.1.1",
[4] From Admin Side, On Right Hand Side Footer Also You can see
On top of the other answer, you can get the major version (for example 2.1) by accessing /magento_version
on your Magento 2 website.