php bin/magento maintenance:enable
composer require magento/product-community-edition 2.x.x --no-update
composer update
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex
php bin/magento maintenance:disable
php bin/magento --version
chmod -R 777 pub var

For more Magento 2 CLi Command click here.