Commands, Magento, Magento2

Magento2 Useful Command List

While we are working on Magento2 store we need few of commands to be executed. But remembering all the commands is little bit tough task.
Here, I will provide you all useful command list for Magneto.

Admin

1. Create an admin user:

php bin/magento admin:user:create

Example:

php bin/magento admin:user:create --admin-user='admin' --admin-password='admin123' --admin-email='admin@xyz.com' --admin-firstname='Aryan' --admin-lastname='Srivastava'

2. Unlock admin user account

php bin/magento admin:user:unlock username

Example:

php bin/magento admin:user:unlock admin

Cache

1. Cleans cache

php bin/magento cache:clean

Short code:

php bin/magento c:c

2. Flushes cache storage

php bin/magento cache:flush

Short code:

php bin/magento c:f

3. Disables cache

php bin/magento cache:disable

Short code:

php bin/magento c:d

4. Enable cache

php bin/magento cache:enable

Short code:

php bin/magento c:e

5. Check cache status

php bin/magento cache:status

Setup

1. Setup upgrades

Upgrades the Magento application, DB data, and schema

php bin/magento setup:upgrade

Short code:

php bin/magento s:up

2. Setup compile

Generates DI configuration and all missing classes that can be auto-generated.

php bin/magento setup:di:compile

Short code:

php bin/magento s:d:c

3. Setup deploy

Deploys static view files.

php bin/magento setup:static-content:deploy

Short code:

php bin/magento s:s:d

Note: In developer/default mode we need to force deploy flag (-f) to deploy static view files.

Example:

php bin/magento setup:static-content:deploy -f

Or

php bin/magento s:s:d -f

4. Uninstall magento application

php bin/magento setup:uninstall

5. Takes backup of Magento Application code base, media and database

php bin/magento setup:backup --code --db --media

Deploy

1. Set deploy mode

Set application mode.

php bin/magento deploy:mode:set <value>

Note: Value can be:

a. developer

b. production

c. default

Example:

php bin/magento deploy:mode:set production

2. Show deploy mode

Displays current application mode.

php bin/magento deploy:mode:show

Dev

1. Enable profiler

php bin/magento dev:profiler:enable

2. Disable profiler

php bin/magento dev:profiler:disable

Maintenance

1. Show status of maintenance mode

php bin/magento maintenance:status

2. Enable maintenance mode

php bin/magento maintenance:enable

Enable maintenance mode except specific IP(s):

php bin/magento maintenance:enable --ip=127.0.0.1 --ip=127.0.0.2

3. Allow specific IP(s)

Sets maintenance mode exempt IPs.

php bin/magento maintenance:allow-ips --ip=127.0.0.1 --ip=127.0.0.2

4. Disable maintenance mode

php bin/magento maintenance:disable

Catalog

1. Create resized product image

php bin/magento catalog:images:resize

2. Removes unused product attributes in magento application using cli

php bin/magento catalog:product:attributes:cleanup

Indexer

1. Show indexer info

php bin/magento indexer:info

Short code:

php bin/magento i:info

2. Show indexer status

php bin/magento indexer:status

Short code:

php bin/magento i:status

3. Reset indexer

php bin/magento indexer:reset

Short code:

php bin/magento i:reset

4. Reindexes data

php bin/magento indexer:reindex

Short code:

php bin/magento i:rei

Module

1. Displays status of modules

php bin/magento module:status

2. Enable modules

php bin/magento module:enable <vendorname_modulename>

Example:

php bin/magento module:enable Magento_TwoFactorAuth Magento_CmsPageBuilderAnalytics

3. Disable modules

php bin/magento module:disable <vendorname_modulename>

Example:

php bin/magento module:disable Magento_TwoFactorAuth Magento_CmsPageBuilderAnalytics

Store

1. Displays the list of stores

php bin/magento store:list

2. Displays the list of websites

php bin/magento store:website:list

Cron

1. Install crontab in magento

php bin/magento cron:install

2. Run cron in magento

php bin/magento cron:run

3. Remove crontab in magento

php bin/magento cron:remove

Info

1. Displays the Magento Admin URI

php bin/magento info:adminuri

2. Prints list of available backup files

php bin/magento info:backups:list

3. Displays the list of available currencies

php bin/magento info:currency:list

4. Displays the list of available language locales

php bin/magento info:language:list

5. Displays the list of available timezones

php bin/magento info:timezone:list
Tagged , ,

About Aryan Srivastava

I'm Aryan Srivastava, a technical blogger. Learn the basics of Magento, front-end technology, comprehension for better programming with experts.
View all posts by Aryan Srivastava →

1 thought on “Magento2 Useful Command List

Leave a Reply

Your email address will not be published.