Magento II – Common Commands
I. Upgrade
Setup Upgrade Using Command Line
php bin/magento setup:upgradeIf you don’t want to remove pub/static files while installing/updating database then use following command.
php bin/magento setup:upgrade --keep-generatedII. Cache
Cache Clean Using Command Line
php bin/magento cache:cleanCache Flush Using Command Line
php bin/magento cache:flushView cache status Using Command Line
php bin/magento cache:statusEnable/Disable Cache Using Command Line
php bin/magento cache:enable [cache_type]php bin/magento cache:disable [cache_type]III. Deployment
Static Content Deploy Using Command Line (Use -f for force deploy on 2.2.x or later)
php bin/magento setup:static-content:deployStatic Content Deploy For Particular Language Using Command Line
php bin/magento setup:static-content:deploy en_USStatic Content Deploy For Magento Backend Theme Using Command Line (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy --theme="Magento/backend"Static Content Deploy For Specific Themes Using Command Line (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy --theme Magento/luma --theme Magento/second_themeExclude Themes on Static Content Deploy and does not minify HTML files Using Command Line (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy en_US --exclude-theme Magento/luma --no-html-minifyIII. Reindex
Reindexing Using Command Line
php bin/magento indexer:reindexView the list of indexers Using Command Line
php bin/magento indexer:infoView indexer status Using Command Line
php bin/magento indexer:statusShow the mode of all indexers Using Command Line
php bin/magento indexer:show-modeIV. Modules
See all modules Status Using Command Line
php bin/magento module:statusEnable/Disable module Using Command Line
php bin/magento module:enable Namespace_Modulephp bin/magento module:disable Namespace_ModuleUninstall Module Using Command Line
php bin/magento module:uninstall Namespace_ModuleV. Maintenance
Enable Maintenance Mode Using Command Line
php bin/magento maintenance:enableTo enable maintenance mode for all clients except 192.0.0.1 and 192.0.0.1:
php bin/magento maintenance:enable --ip=192.0.0.1 --ip=192.0.0.2To clear the list of IPs.
php bin/magento maintenance:enable --ip=noneDisable Maintenance Mode Using Command Line
php bin/magento maintenance:disableCheck Maintenance Mode Status Using Command Line
php bin/magento maintenance:statusAllow IP on Maintenance Mode Using Command Line
php bin/magento maintenance:allow-ips --ip=192.0.0.1 --ip=192.0.0.2VI. Deployment
Check Current Mode Using Command Line
php bin/magento deploy:mode:showChange To Developer Mode Using Command Line
php bin/magento deploy:mode:set developerChange To Production Mode Using Command Line
php bin/magento deploy:mode:set productionRun the single-tenant Compiler Using Command Line
php bin/magento setup:di:compileVII. Admin
Unlock Admin User Using Command Line
php bin/magento admin:user:unlock <adminusername>


