Table of content
- Introduction
- Magento 2 command line to create and unlock an administrator account
- To create an administrator account
- To unlock an admin account
- Command line for creating, capturing, or downloading the app
- Magento cache management
- To clean Magento caches
- To disable caches
- To allow Magento caches
- To check the status of Magento Caches.
- Manage Magento catalog
- Manage your Magento CRON projects
- Upgrade client content to latest algorithm
- Deploy command lines
- dev command lines
- i18n command line
- Indexer command lines
- Get more information with the command line
- Manage Maintenance Mode with Magento 2 Command Line
- Manage modules with the command line
- Get and manage sample data with the command line
- Magento 2 Command Line Configuration Management
- Conclusion on Magento 2 Command Line Checklist
Introduction
Are you a Magento 2 developer and usually work with the command line interface? In this article, I am sharing with you some of the Magento 2 command lines for your project. You can use it as a checklist on the command line to save time during your development process.
Magento 2 command line to create and unlock an administrator account
In some cases, it is not possible to use the Magento dashboard to create an administrator. For example, if you don't have the dashboard administrator, you can access your account to create another user. If this happens, you can try with the command line interface.
To create an administrator account
In order to create an Admin account, you can use the following php code:
php bin/Magento admin:user:create
To unlock an admin account
To unlock an administrator account, use this code:
php bin/Magento admin:user:unlock
Command line for creating, capturing, or downloading the app
The php code for the command line to create, capture or dump the application is as follows:
php bin/Magento app:config:dump
Magento cache management
Whenever you make essential changes to your website, you should clear or flush the caches for those changes to take effect immediately. Using the command lines below, you can clean, list, disable, or enable caches.
To clean Magento caches
Here is a sample code you can use to clean Magento caches:
php bin/magento cache:clean
To disable caches
In order to disable the caches, you can use the following code:
php bin/magento cache:disable
To allow Magento caches
The code to enable Magento caches is:
php bin/magento cache:enable
To clear Magento caches Here is a sample code to clear Magento caches:
php bin/magento cache:flush
To check the status of Magento Caches.
If you want to check the status of Magento caches, you can use the following code:
php bin/magento cache:status
Manage Magento catalog
To create resized product images, use the code:
php bin/magento catalog:images:resize
To delete unused product attributes:
php bin/magento catalog:product:attributes:cleanup
Manage your Magento CRON projects
To run jobs on schedule, use:
php bin/magento cron:run
Upgrade client content to latest algorithm
For this you can use the following code:
php bin/magento customer:hash:upgrade
Deploy command lines
The code to set the application mode is:
php bin/magento deploy:mode:set
To display the current application mode, use:
php bin/magento deploy:mode:show
dev command lines
Magento 2 dev command lines are used to collect and publish theme source files. The following code can be used:
php bin/magento dev:source-theme:deploy
In order to perform tests use:
php bin/magento dev:tests:run
Generate the catalog of URNs to *.xsd mappings for the IDE to highlight the XML using code:
php bin/magento dev:urn-catalog:generate
Convert the XML file using XSL style sheets with the code:
php bin/magento dev:xml:convert
i18n command line
Discover phrases in the code database using the following:
php bin/magento i18n:collect-phrases
Saving the language module with the code:
php bin/magento i18n:pack
Uninstall language packs with:
php bin/magento i18n:uninstall
Indexer command lines
Display allowed indexers with the following code:
php bin/magento indexer:info
Re-index the data with:
php bin/magento indexer:reindex
Reset the indexer status to invalid using:
php bin/magento indexer:reset
Set the type of indexing mode with the code:
php bin/magento indexer:set-mode
Display index mode using the following:
php bin/magento indexer:show-mode
Indicate the status of the indexer with:
php bin/magento indexer:status
Get more information with the command line
Display the Magento Admin URI using the code:
php bin/magento info:adminuri
Print the list of backup files available with:
php bin/magento info:backups:list
Display the list of available currencies using:
php bin/magento info:currency:list
The code allows you to indicate the number of dependencies on the Magento framework:
php bin/magento info:dependencies:show-framework
Indicate the number of dependencies between modules using the following:
php bin/magento info:dependencies:show-modules
To let you show how many circular dependencies between modules you can use:
php bin/magento info:dependencies:show-modules-circular
Display the list of available local languages with:
php bin/magento info:language:list
Display the list of available time zones using the following code:
php bin/magento info:timezone:list
Manage Maintenance Mode with Magento 2 Command Line
Set the maintenance mode to exempt IPs using the code:
php bin/magento maintenance:allow-ips
Disable maintenance mode with:
php bin/magento maintenance:disable
Enable the use of maintenance mode:
php bin/magento maintenance:enable
View the maintenance mode status following this code:
php bin/magento maintenance:status
Manage modules with the command line
Disable the specified modules with the code:
module php bin/magento:disable
Authorize the use of specific modules:
module php bin/magento:enable
Display the status of modules with:
php bin/magento module:status
Uninstall composer-installed modules using the following:
phpbin/magento module:uninstall
Get and manage sample data with the command line
Deploy the type data module using the following code:
php bin/magento sampledata:deploy
Remove all sample data packets from composer.json with code:
php bin/magento sampledata:remove
Reset all typical data modules to reinstall them using:
php bin/magento sampledata:reset
Magento 2 Command Line Configuration Management
Support backup of codebase, media and database of Magento application using following code:
php bin/magento setup:backup
Create or modify the deployment configuration using:
php bin/magento setup:config:set
Run the cron program intended for the configuration application with:
php bin/magento setup:cron:run
Install and update the data in the database with the following code:
php bin/magento setup:db-data:upgrade
Install and update the DB schema using:
php bin/magento setup:db-schema:upgrade
Check if the DB schema or data needs to be updated with the following code:
php bin/magento setup:db:status
Generate the ID configuration and any missing classes that can be auto-generated using the code:
php bin/magento setup:di:compile
Install the Magento app with:
php bin/magento setup:install
Generate fixtures using the following code: php bin/magento setup:performance:generate-fixtures Return to the Magento application codebase, media and database with:
php bin/magento setup:rollback
Deploy static view files using the code:
php bin/magento setup:static-content:deploy
Install store configuration with code:
php bin/magento setup:store-config:set
Uninstall the Magento app with this code:
php bin/magento setup:uninstall
Update the Magento application, database data and schema using the following code:
php bin/magento setup:upgrade
Conclusion on Magento 2 Command Line Checklist
Please note that the Magento 2 command line checklist above is for the default Magento 2 website. For example, as you install modules or features, you may have more orders for your project. If you want to get the full list of commands available on your site, just type the code:
php bin/magento list
Thank you for reading, if you like this article, you may also like
- "Here are four different approaches to reset a Magento 2 Admin password".
- Magento
- 5 tips to boost the conversion of your website.
If you need help with your Magento project, you can contact us .
Leave a comments: