Rate this post

Part 3: Manage modules using CLI

Welcome to our serial articles on Magento 2 Command Lines (CLI)!

You know Magento 2 has provided the powerful command-line interface tool (CLI). It allows you to perform tasks including installation, configuration, database backups, compiling LESS etc. Today I will show you how to install, enable/ disable, update database of modules in Magento 2 using CLI. Before starting this guide, please review our previous posts.

use all commands in Magento 2
use all commands in Magento 2

1.Install/ uninstall module

  • Install module
php bin/magento setup:upgarde

This command will install and update database of all modules in Magento 2. Note that after run this command, you should change mode of var & pub folders

chmod -R 777 var

chmod -R  777 pub

  • Uninstall module

The command below will uninstall the module Magestore_BannerSlider

Let I explain the options of uninstall module command

Option Description Directory system
–backup-code Backup Magento files (exclude the var and pub/static folder) var/backups/<timestamp>_filesystem.tgz
–backup-media Backup the pub/media folder var/backups/<timestamp>_filesystem_media.tgz
–backup-db Backup the database of Magento site var/backups/<timestamp>_db.gz

2.Enable/ Disable Module

  • Enable Module
php bin/magento module:enable [-c|–clear-static-content] [-f|–force] [–all] <module-list>
  • Disable Module
php bin/magento module:disable [-c|–clear-static-content] [-f|–force] [–all] <module-list>

Let I explain the options of this command

Option Description
-c | –clear-static-content Clean static view files (pub/static)
-f | –force Force a module to be enabled or disabled despite dependencies
–all Enable or disable all modules at the same time
<module-list> A space-delimited list of modules to enable or disable, such as: Magento_Catalog Magento_CatalogSearch

The command below will disable module Magestore_BannerSlider

php bin/magento module:disable -c -f Magestore_BannerSlider

3.Update database of Modules

Upgrade database schema

php bin/magento setup:db-schema:upgrade

Upgrade data

php bin/magento setup:db-data:upgrade

The 2 steps I mention above is the shortest process for you to Use All Commands in Magento 2 CLI in Magento 2. With this guide, you can manage the Product Image in Checkout Cart in Magento 2 easily. Every store has a Change Product Image in Checkout Cart in Magento 2 with many attributes.

Thank you for reading this post and see you in other posts from Magestore!

How to Use WYSIWYG Editor in Configuration Section in Magento 2
How to Use All Commands in Magento 2 CLI (Part 4)