I am a Magento developer but when I have started learning about Magento at that time I was thinking about the meaning of the CLI command and I was not getting that meaning, but here I am sharing with you that all Magento 2 commands meaning after gaining a lot of development experience.
The most common command of Magento 2 is setup: upgrade and many new developers used to run this command at every time.
So, In this article, I will discuss the Magento 2 command run and why we run the command, and what changes need what commands to reflect changes on the Magento 2 frontend or backend.
Magento 2 Setup: Upgrade Command
This is one of the most common commands for Magento developers so let's understand the meaning of this command.
php bin/magento setup:upgrade
And the short form of this setup upgrade command is:
php bin/magento set:up
So, When we should run this command?
This command we can run in the following case.
When we have done any changes in the setup script or when we install any Magento 2 new extension so we need to upgrade this command.
For:
- InstallData, InstallSchema,UpgradeSchama, Upgradation
- For any new module installation
- In case of setup_version change in module.xml
- After Magento 2 upgradation version
Static Content Deploy Magento 2
This is the second most used command in Magento 2. So whenever we do any changes in the JS file, CSS file, or HTML file then we need to generate the static content of that file so we run this command.
php bin/magento setup:static-content:deploy
And the shot for of static content deploy command in Magento 2 is:
php bin/magento s:s:d
This command is used to delete the old static generated file. In the Magento 2 developer mode no more needs to run this command.
Setup DI Compile Command
Whenever we use a new dependency then we need to construct that dependency in the project so we run this command.
php bin/magento setup:di:compile
This setup di compile command also has the short form command and we can use:
php bin/magento s:d:c
if we have added any new controller class then also this command is required.
Cache Clean and Cache Flush Magento 2 Commands
This command we use to see the reflected changes on the frontend so we clear all the Magento server cache. We use this Magento 2command in the following conditions.
- And for admin configuration,
- layout XML changes
- UI component changes
- phtml file changes
- override HTML changes
- js in frontend theme.
php bin/magento cache:flush Short Form: php bin/magento c:f
Magento 2 Commands: Important CLI/SSH Command-List
Here, I am giving you the list of all Magento 2 available commands so it would be very easy to get all the detailed descriptions and short commands of Magento 2.
SSH Commands | Shortcuts | Description |
Available commands:
|
||
help | h |
Displays help for a command
|
php bin/magento list | php bin/magento l | Lists commands |
admin | All Admin Command | |
php bin/magento admin:user:create | php bin/magento a:u:c |
Creates an administrator
|
php bin/magento admin:user:unlock | php bin/magento a:u:u |
Unlock Admin Account
|
app | ||
php bin/magento app:config:dump
|
Create dump of application
|
|
php bin/magento app:config:import
|
Import data from shared configuration files to appropriate data storage
|
|
cache | Magento 2 Avilable Cache Command | |
php bin/magento cache:clean | php bin/magento c:c |
Cleans cache type(s)
|
php bin/magento cache:disable | php bin/magento c:d |
Disables cache type(s)
|
php bin/magento cache:enable | php bin/magento c:e |
Enables cache type(s)
|
php bin/magento cache:flush | php bin/magento c:f |
Flushes cache storage used by cache type(s)
|
php bin/magento cache:status | php bin/magento c:s |
Checks cache status
|
catalog | Catalog Realted Magento 2 Command | |
php bin/magento catalog:images:resize | php bin/magento c:i:r |
Creates resized product images
|
php bin/magento catalog:product:attributes:cleanup | php bin/magento c:p:a:c |
Removes unused product attributes.
|
config | Change Magento 2 Configuration Command | |
php bin/magento config:sensitive:set
|
Set sensitive configuration values
|
|
php bin/magento config:set
|
Change system configuration
|
|
php bin/magento config:show
|
Shows configuration value for given path. If path is not specified, all saved values will be shown
|
|
cron | All Cron Job Command in Magento 2 | |
php bin/magento cron:install
|
Generates and installs crontab for the current user
|
|
php bin/magento cron:remove
|
Removes tasks from crontab
|
|
php bin/magento cron:run | php bin/magento c:r |
Runs jobs by schedule
|
customer | Magento 2 Customer Command | |
php bin/magento customer:\hash:upgrade | php bin/magento c:h:u |
Upgrade customer’s hash according to the latest algorithm
|
deploy | ||
php bin/magento deploy:mode:set | php bin/magento d:m:set |
Set application mode.
|
php bin/magento deploy:mode:show | php bin/magento d:m:sho |
Displays current application mode.
|
dev | ||
php bin/magento dev:di:info
|
Provides information on Dependency Injection configuration for the Command.
|
|
php bin/magento dev:query-log:disable
|
Disable DB query logging
|
|
php bin/magento dev:query-log:enable
|
Enable DB query logging
|
|
php bin/magento dev:source-theme:deploy | php bin/magento d:s:d |
Collects and publishes source files for theme.
|
php bin/magento dev:template-hints:disable
|
Disable frontend template hints. A cache flush might be required.
|
|
php bin/magento dev:template-hints:enable
|
Enable frontend template hints. A cache flush might be required.
|
|
php bin/magento dev:tests:run | php bin/magento d:t:r | Runs tests |
php bin/magento dev:urn-catalog:generate | php bin/magento d:u:g |
Generates the catalog of URNs to *.xsd mappings for the IDE to highlight xml.
|
php bin/magento dev:xml:convert | php bin/magento d:x:c |
Converts XML file using XSL style sheets
|
i18n | Avilable Lang. Command in Magento 2 | |
php bin/magento i18n:collect-phrases | php bin/magento i1:c |
Discovers phrases in the codebase
|
php bin/magento i18n:pack | php bin/magento i:p |
Saves language package
|
php bin/magento i18n:uninstall | php bin/magento i:u |
Uninstalls language packages
|
indexer | List of indexer Command in Magento 2 | |
php bin/magento indexer:info | php bin/magento i:i |
Shows allowed Indexers
|
php bin/magento indexer:reindex | php bin/magento i:rei | Reindexes Data |
php bin/magento indexer:reset | php bin/magento i:res |
Resets indexer status to invalid
|
php bin/magento indexer:set-mode | php bin/magento i:set |
Sets index mode type
|
php bin/magento indexer:show-mode | php bin/magento i:sho |
Shows Index Mode
|
php bin/magento indexer:status | php bin/magento i:sta |
Shows status of Indexer
|
info | ||
php bin/magento info:adminuri | php bin/magento i:a |
Displays the Magento Admin URI
|
php bin/magento info:backups:list | php bin/magento i:b:l |
Prints list of available backup files
|
php bin/magento info:currency:list | php bin/magento i:c:l |
Displays the list of available currencies
|
php bin/magento info:dependencies:show-framework | php bin/magento i:d:show-f |
Shows number of dependencies on Magento framework
|
php bin/magento info:dependencies:show-modules
|
Shows number of dependencies between modules
|
|
php bin/magento info:dependencies:show-modules-circular
|
Shows number of circular dependencies between modules
|
|
php bin/magento info:language:list | php bin/magento i:l:l |
Displays the list of available language locales
|
php bin/magento info:timezone:list | php bin/magento i:t:l |
Displays the list of available timezones
|
maintenance | ||
php bin/magento maintenance:allow-ips | php bin/magento m:a |
Sets maintenance mode exempt IPs
|
php bin/magento maintenance:disable | php bin/magento ma:d |
Disables maintenance mode
|
php bin/magento maintenance:enable | php bin/magento ma:e |
Enables maintenance mode
|
php bin/magento maintenance:status | php bin/magento ma:s |
Displays maintenance mode status
|
module | Magento Module Command | |
php bin/magento module:disable | php bin/magento mo:d |
Disables specified modules
|
php bin/magento module:enable | php bin/magento mo:e |
Enables specified modules
|
php bin/magento module:status | php bin/magento mo:s |
Displays status of modules
|
php bin/magento module:uninstall | php bin/magento m:u |
Uninstalls modules installed by composer
|
sampledata | ||
php bin/magento sampledata:deploy | php bin/magento sa:d |
Deploy sample data modules
|
php bin/magento sampledata:remove | php bin/magento sa:rem |
Remove all sample data packages from composer.json
|
php bin/magento sampledata:reset | php bin/magento sa:res |
Reset all sample data modules for re-installation
|
setup | ||
php bin/magento setup:backup | php bin/magento s:b |
Takes backup of Magento Application code base, media and database
|
php bin/magento setup:config:set | php bin/magento s:c:s |
Creates or modifies the deployment configuration
|
php bin/magento setup:cron:run | php bin/magento s:c:r |
Runs cron job scheduled for setup application
|
php bin/magento setup:db-data:upgrade | php bin/magento s:db-d:u |
Installs and upgrades data in the DB
|
php bin/magento setup:db-schema:upgrade | php bin/magento s:db-s:u |
Installs and upgrades the DB schema
|
php bin/magento setup:db:status | php bin/magento s:d:s |
Checks if DB schema or data requires upgrade
|
php bin/magento setup:di:compile | php bin/magento s:d:c |
Generates DI configuration and all missing classes that can be auto-generated
|
php bin/magento setup:install | php bin/magento s:i |
Installs the Magento application
|
php bin/magento setup:performance:generate-fixtures | php bin/magento s:p:g |
Generates fixtures
|
php bin/magento setup:rollback | php bin/magento se:r |
Rolls back Magento Application codebase, media and database
|
php bin/magento setup:static-content:deploy | php bin/magento s:s:d |
Deploys static view files
|
php bin/magento setup:store-config:set | php bin/magento s:s:s |
Installs the store configuration. Deprecated since 2.2.0. Use config:set instead
|
php bin/magento setup:uninstall | php bin/magento s:un |
Uninstalls the Magento application
|
php bin/magento setup:upgrade | php bin/magento s:up |
Upgrades the Magento application, DB data, and schema
|
store | ||
php bin/magento store:list
|
Displays the list of stores
|
|
store:website:list
|
Displays the list of websites
|
|
theme | ||
php bin/magento theme:uninstall | php bin/magento t:u |
Uninstalls theme
|
varnish | ||
php bin/magento varnish:vcl:ge
|
These all are Magento 2 default commands, we can create a custom SSH/CLI command in Magento 2, so that is all are different topics and we will discuss it in another post.
Related Post:
Magento 2 Top Developers In USA: Develop Your E-Commerce Websites
File Permissions: Magento 2 Ownership And File Permission At Installation
Recommend Post:
eCommerce Framework: Magento 2 eCommerce Developers in India
Magento Store: Best 36 Magento Websites Example in The World