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 username
Setup upgrades using the CLI :
php bin/magento setup:upgrade
Setup upgrades without remove pub/static files using the CLI :
php bin/magento setup:upgrade --keep-generated
Uninstalls the Magento application using the CLI :
php bin/magento setup:uninstall
Cache clean using the CLI :
php bin/magento cache:clean
Cache clean with specific type using the CLI :
php bin/magento cache:clean cache_type
Disable cache using the CLI :
php bin/magento cache:disable
Disable cache with specific type using the CLI :
php bin/magento cache:disable cache_type
Enable cache using the CLI :
php bin/magento cache:enable
Enable cache with specific type using the CLI :
php bin/magento cache:enable cache_type
Flush cache using the CLI :
php bin/magento cache:flush
Flush cache with specific type using the CLI :
php bin/magento cache:flush cache_type
Check cache status using the CLI :
php bin/magento cache:status
Static 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:deploy
Deploys for specific language using the CLI :
php bin/magento setup:static-content:deploy en_US
Deploys 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_two
Exclude 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-minify
Creates resized product images using the CLI :
php bin/magento catalog:images:resize
Removes unused product attributes using the CLI :
php bin/magento catalog:product:attributes:cleanup
Set Magento crontab using the CLI :
php bin/magento cron:install --force
Runs jobs by schedule using the CLI :
php bin/magento cron:run
Remove Magento crontab using the CLI :
php bin/magento cron:remove
Reindexing using the CLI :
php bin/magento indexer:reindex
List of indexers using the CLI :
php bin/magento indexer:info
View indexer status using the CLI :
php bin/magento indexer:status
Show the mode of all indexers using the CLI :
php bin/magento indexer:show-mode
Resets indexer status to invalid using the CLI :
php bin/magento indexer:reset
Sets 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_category
Collects 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" -m
Collects 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\frontend
Uninstall 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 developer
Set production mode using the CLI :
php bin/magento deploy:mode:set production
Check current mode using the CLI :
php bin/magento deploy:mode:show
DI compilation using the CLI :
php bin/magento setup:di:compile
See all modules status using the CLI :
php bin/magento module:status
Enable module using the CLI :
php bin/magento module:enable VendorName_ModuleName
Disable module using the CLI :
php bin/magento module:disable VendorName_ModuleName
Uninstall module using the CLI :
php bin/magento module:uninstall VendorName_ModuleName
Prints list of available backup files using the CLI :
php bin/magento info:backups:list
List of available currencies using the CLI :
php bin/magento info:currency:list
List of available language locales using the CLI :
php bin/magento info:language:list
Displays the list of available timezones using the CLI :
php bin/magento info:timezone:list
Enable maintenance mode using the CLI :
php bin/magento maintenance:status
Enable maintenance mode for all clients except specific IPs :
php bin/magento maintenance:enable --ip=127.0.0.1 --ip=127.0.0.2
Allow IP on maintenance mode using the CLI :
php bin/magento maintenance:allow-ips --ip=127.0.0.1 --ip=127.0.0.2
Clear the list of IPs using the CLI :
php bin/magento maintenance:enable --ip=none
Disable maintenance mode using the CLI :
php bin/magento maintenance:disable
Check maintenance mode status using the CLI :
php bin/magento maintenance:status
Displays the list of stores using the CLI :
php bin/magento store:list
Displays the list of websites using the CLI :
php bin/magento store:website:list
Takes backup of Magento Application code base, media and database using the CLI :
php bin/magento setup:backup
I 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 🙂