In Magento 2 we need to run some SSH/CLI commands and sometimes developer face trouble to find right SSH/CLI command in Magento 2, such as indexing, enable/disable cache, compile code etc.
So in this post we mentioned list of most important SSH/CLI commands for Magento 2. I suggest to bookmark this post so you can easily get list of useful Magento 2 SSH/CLI commands.
Setup upgrade using the CLI
php bin/magento setup:upgrade
Setup upgrades without removing pub/static files using the CLI:
php bin/magento setup:upgrade --keep-generated
Cache Flush Using Command Line
php bin/magento cache:flush
Cache Clean Using Command Line
php bin/magento cache:clean
View cache status Using Command Line
php bin/magento cache:status
Enable Cache Using Command Line
php bin/magento cache:enable [cache_type]
Disable Cache Using Command Line
php bin/magento cache:disable [cache_type]
Static Content Deploy Using Command Line
php bin/magento setup:static-content:deploy
Static Content Deploy For Particular Language Using Command Line
php bin/magento setup:static-content:deploy en_US
Reindexing Using Command Line
php bin/magento indexer:reindex
View the list of indexers Using Command Line
php bin/magento indexer:info
View indexer status Using Command Line
php bin/magento indexer:status
Show the mode of all indexers Using Command Line
php bin/magento indexer:show-mode
See all modules Status Using Command Line
php bin/magento module:status
Enable module Using Command Line
php bin/magento module:enable Namespace_Module
Disable module Using Command Line
php bin/magento module:disable Namespace_Module
Uninstall Module Using Command Line
php bin/magento module:uninstall Namespace_Module
Check Current Mode Using Command Line
php bin/magento deploy:mode:show
Change To Production Mode Using Command Line
php bin/magento deploy:mode:set production
DI compilation using Command Line
php bin/magento setup:di:compile
Enable Maintenance Mode Using Command Line
php bin/magento maintenance:enable
To enable maintenance mode for all clients except 169.0.0.1 and 169.0.0.2
php bin/magento maintenance:enable --ip=169.0.0.1 --ip=169.0.0.2
To clear the list of IPs for maintenance mode
php bin/magento maintenance:enable --ip=none
Disable Maintenance Mode Using Command Line
php bin/magento maintenance:disable
Check Maintenance Mode Status Using Command Line
php bin/magento maintenance:status
Create an admin user Using Command Line
php bin/magento admin:user:create --admin-user='admin' --admin-password='admin123' --admin-email='admin@domain.com' --admin-firstname='John' --admin-lastname='Smith'
Unlock admin user account Using Command Line
php bin/magento admin:user:unlock username





