As you already know commands are how much important for magento 2.If you go through the official magento 2 command list document, you’ll find there is huge list of commands. So today i’ll share here the most important magento 2 commands, which you must have to know before developing a website/platform/extension with magento 2.
But before going to the command list ,I would like to say you must have little knowledge about SSH/CLI, because if you are on live server you have to login SSH/CLI with root access to run these commands, but if you are on local server (xampp/wamp/mamp) then no need to worry about SSH/CLI , you can run all these commands directly from your command terminal.
Now, let’s see the most useful command list for magento 2 :
#01 .For Cache Clean
php bin/magento cache:clean
#02. For Cache Flush
php bin/magento cache:flush
#03.1 For Static Content Deploy (Magento 2.2.x )
php bin/magento setup:static-content:deploy -f
#03.2 For Static Content Deploy (Magento 2.3.x )
php bin/magento setup:static-content:deploy
#04. For Reindexing
php bin/magento indexer:reindex
#05. For Enable module
php bin/magento module:enable Namespace_Module
#06. For Disable module
php bin/magento module:disable Namespace_Module
#07. For Uninstall Module
php bin/magento module:uninstall Namespace_Module
#08. See all modules Status
php bin/magento module:status
#09. Check Current Mode
php bin/magento deploy:mode:show
#10. Change Current Mode
/* Change mode to Developer Mode */
php bin/magento deploy:mode:set developer
/* Change mode to Production Mode */
php bin/magento deploy:mode:set production
#11. Unlock Admin User
php bin/magento admin:user:unlock adminusername
#12. Enable Maintenance Mode
/* Enable maintenance mode for all */
php bin/magento maintenance:enable
/* Enable maintenance mode for specific ip range */
php bin/magento maintenance:enable --ip=192.0.0.1 --ip=192.0.0.2
/* Clear IPs from maintenance list */
php bin/magento maintenance:enable --ip=none
#13. Disable Maintenance Mode
php bin/magento maintenance:disable
#14. Check Maintenance Mode Status
php bin/magento maintenance:status
#15. Allow IP on Maintenance Mode
php bin/magento maintenance:allow-ips --ip=192.0.0.1 --ip=192.0.0.2
#16. Compiles all non-existent proxies and factories
php bin/magento setup:di:compile
#17. To display a complete list of commands
php bin/magento list
#18. To get help for a particular command
php bin/magento help <command>
#19. Runs Magento cron jobs
php bin/magento cron:run
#20. Setup Upgrade
php bin/magento setup:upgrade