This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

A Guide About Using Magento 2 CLI

Updated on  4th January

2 Min Read
Reading Time: 2 minutes

With the new version of Magento 2, there is a newer CLI tool available as well which is more powerful than the previous Mage tool. I’ll be sharing how you can use Magento 2 CLI with the most common options that we will be using while managing your store.

Magento 2 CLI

Cache

As the name suggest, this option can manipulate the Magento’s Caching option. You can enable, disable, clean, flush or check status of magento’s caching with this option. Few examples are:

Indexer

The indexer will be a more widely used option in Magento 2 as now there is no method to update indexing manually from Magento’s Admin. Besides reindexing, you have the options to set indexing mode and to check the status of indexer via CLI.

Admin

With this option, you can create admin user from command line or you can unlock the users that are already created.

Module

This option can be used to enable, disable, uninstall or check status of all the installed modules of Magento. Disabling or uninstalling of module will fail with this option if there is any dependency of that module. Few examples are:

Cron

With this option, we can execute the scheduled Magento’s Cron jobs manually. You can put this command in the scheduler, so the application’s task can be executed in a timely manner.

Setup

There are plenty of things you can do with this option, but we’ll go through two of them as I think these are ones which you will be using more frequently.

a- Backup

We can backup our application’s code, database, and media files through this option. Backup can be found in var/backup/directory of your web root.

b- Config:set

This option can be used to make configuration changes on Magento. The changes involve DB parameters, admin URL, etc. You can see your provided values reflected in app/etc/env.php file.

Fairly speaking, we have more freedom in working via command line on this new version of Magento. With this flexibility, there is little need for using Magento admin for store management.

We know that we do not have Magento 2 as an app on Cloudways. Well, we are creating a dedicated stack for Magento 2 websites. Till then, you can install Magento 2 on PHP using this tutorial. We recommend you to use our plain PHP stack.

Share your opinion in the comment section. COMMENT NOW

Syed Maad Jahangir

Syed Maad Jahangir worked as Senior System Engineer at Cloudways.

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

Get Our Newsletter
Be the first to get the latest updates and tutorials.

THERE’S MORE TO READ.