
In this tutorial, I will give you all the command list which is useful for Magento 2. Sometimes, we need to perform some operations and we do that using programmatically but, it was also complete by just single line command execute. So, why we do programming operations. So, the command line interface saves your maximum time and execute operation very quickly.
I have some important command list which is used in Magento 2. You can use it in your local server/system or FTP server by SSH access.
You may also like this :
Magento 2 Useful Command List :
Create an admin user using the CLI :
php bin/magento admin:user:create --admin-user='admin' --admin-password='admin123' --admin-email='admin@xyz.com' --admin-firstname='Rohan' --admin-lastname='Hapani'Unlock admin user account using the CLI :
php bin/magento admin:user:unlock usernameSetup upgrades using the CLI :
php bin/magento setup:upgradeSetup upgrades without remove pub/static files using the CLI :
php bin/magento setup:upgrade --keep-generatedUninstalls the Magento application using the CLI :
php bin/magento setup:uninstallCache clean using the CLI :
php bin/magento cache:cleanCache clean with specific type using the CLI :
php bin/magento cache:clean cache_typeDisable cache using the CLI :
php bin/magento cache:disableDisable cache with specific type using the CLI :
php bin/magento cache:disable cache_typeEnable cache using the CLI :
php bin/magento cache:enableEnable cache with specific type using the CLI :
php bin/magento cache:enable cache_typeFlush cache using the CLI :
php bin/magento cache:flushFlush cache with specific type using the CLI :
php bin/magento cache:flush cache_typeCheck cache status using the CLI :
php bin/magento cache:statusStatic content deploy using the CLI : (Use -f for force deploy on 2.2.x or later)
php bin/magento setup:static-content:deploy or php bin/magento -f setup:static-content:deployDeploys for specific language using the CLI :
php bin/magento setup:static-content:deploy en_USDeploys for Magento backend theme using the CLI :
php bin/magento setup:static-content:deploy --theme="Magento/backend"Static content deploys for specific themes using the CLI :
php bin/magento setup:static-content:deploy --theme Magento/luma --theme Magento/theme_number_twoExclude themes on static content deploy and does not minify HTML files using the CLI :
php bin/magento setup:static-content:deploy en_US --exclude-theme Magento/luma --no-html-minifyCreates resized product images using the CLI :
php bin/magento catalog:images:resizeRemoves unused product attributes using the CLI :
php bin/magento catalog:product:attributes:cleanupSet Magento crontab using the CLI :
php bin/magento cron:install --forceRuns jobs by schedule using the CLI :
php bin/magento cron:runRemove Magento crontab using the CLI :
php bin/magento cron:removeReindexing using the CLI :
php bin/magento indexer:reindexList of indexers using the CLI :
php bin/magento indexer:infoView indexer status using the CLI :
php bin/magento indexer:statusShow the mode of all indexers using the CLI :
php bin/magento indexer:show-modeResets indexer status to invalid using the CLI :
php bin/magento indexer:resetSets index mode type using the CLI :
- realtime: Equivalent of M1 update on save
- schedule: Sets the specified indexers to save according to the cron schedule.
php bin/magento indexer:set-mode {schedule|realtime} [indexer]Example:
php bin/magento indexer:set-mode schedule catalog_category_product catalog_product_categoryCollects all phrases in the Magento with 4 columns using the CLI :
php bin\magento i18n:collect-phrases -o "\var\www\html\magento\app\design\i18n\xx_YY.csv" -mCollects all phrases in the Magento with 2 columns using the CLI :
php bin\magento i18n:collect-phrases -o "\var\www\html\magento\app\design\i18n\xx_YY.csv" \var\www\html\magento\app\design\frontendUninstall language packages using the CLI :
php bin\magento i18n:uninstall [-b|--backup-code] {language package name}Set developer mode using the CLI :
php bin/magento deploy:mode:set developerSet production mode using the CLI :
php bin/magento deploy:mode:set productionCheck current mode using the CLI :
php bin/magento deploy:mode:showDI compilation using the CLI :
php bin/magento setup:di:compileSee all modules status using the CLI :
php bin/magento module:statusEnable module using the CLI :
php bin/magento module:enable VendorName_ModuleNameDisable module using the CLI :
php bin/magento module:disable VendorName_ModuleNameUninstall module using the CLI :
php bin/magento module:uninstall VendorName_ModuleNamePrints list of available backup files using the CLI :
php bin/magento info:backups:listList of available currencies using the CLI :
php bin/magento info:currency:listList of available language locales using the CLI :
php bin/magento info:language:listDisplays the list of available timezones using the CLI :
php bin/magento info:timezone:listEnable maintenance mode using the CLI :
php bin/magento maintenance:statusEnable maintenance mode for all clients except specific IPs :
php bin/magento maintenance:enable --ip=127.0.0.1 --ip=127.0.0.2Allow IP on maintenance mode using the CLI :
php bin/magento maintenance:allow-ips --ip=127.0.0.1 --ip=127.0.0.2Clear the list of IPs using the CLI :
php bin/magento maintenance:enable --ip=noneDisable maintenance mode using the CLI :
php bin/magento maintenance:disableCheck maintenance mode status using the CLI :
php bin/magento maintenance:statusDisplays the list of stores using the CLI :
php bin/magento store:listDisplays the list of websites using the CLI :
php bin/magento store:website:listTakes backup of Magento Application code base, media and databaseusing the CLI :
php bin/magento setup:backupI hope this blog is easy to understand about Magento 2 Command List. In case, I missed anything or need to add some information, always feel free to leave a comment in this blog, I’ll get back with proper solution 🙂
