Our Feature Items: SM Market // SM AutoStore // SP Revo
Shopping cart (0)

Need To Know The Most Useful Magento 2 Command Lines

Rate this item
(1 Vote)
Written by  Sarah
Wednesday, 13 June 2018 11:22
Need To Know The Most Useful Magento 2 Command Lines - 5.0 out of 5 based on 1 vote

Hi guys!

As you know, Magento 2 has the console command line and it is very useful. You can quickly reindex or flush the cache at fast speed. In this tutorial, we will show you how to use Magento 2 Command line Interface properly.

Magento 223 Themes

The following table summarizes is the list of most important SSH/CLI commands for Magento 2 that you need to know. To use these commands you will need to have SSH access to your server or use the Command Line for local access.

NOTE: To use Magento 2 Command line Interface, you must install php_cli. Please go to the Magento 2 root folder and type:

php bin/magento

If you see all available commands of the command-line utility, the php_cli is installed so you can use the Magento 2 console normally. If not, you should install the php_cli.

If your sever is ubuntu, you can install by the command:

Sudo apt-get install php-cli

MAGENTO 2 COMMAND LINE


Command
Description
php bin/magento setup:upgradeSetup Upgrade Using Command Line
php bin/magento cache:flush
Cache Flush Using Command Line
php bin/magento cache:clean
Cache Clean Using Command Line
php bin/magento cache:status
View cache status Using Command Line
php bin/magento cache:enable [cache_type]
Enable Cache Using Command Line
php bin/magento setup:static-content:deploy
Static Content Deploy Using Command Line (Use -f for force deploy on 2.2.x or later)
php bin/magento setup:static-content:deploy en_US
Static Content Deploy For Particular Language Using Command Line
php bin/magento indexer:reindex
To Reindex Magento Static Blocks
php bin/magento setup:static-content:deploy --theme="Magento/backend"
Static Content Deploy For Magento Backend Theme Using Command Line (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy --theme Magento/luma --theme Magento/second_theme
Static Content Deploy For Specific Themes Using Command Line (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy en_US --exclude-theme Magento/luma --no-html-minify
Exclude Themes on Static Content Deploy and does not minify HTML files Using Command Line (Working on 2.1.1 or later)
php bin/magento indexer:reindex
Reindexing Using Command Line
php bin/magento indexer:info
View the list of indexers Using Command Line
php bin/magento indexer:status
View indexer status Using Command Line
php bin/magento indexer:show-mode
Show the mode of all indexers Using Command Line
php bin/magento module:status
See all modules Status Using Command Line
php bin/magento module:enable Namespace_Module
Enable module Using Command Line
php bin/magento module:disable Namespace_Module
Disable module Using Command Line
php bin/magento module:uninstall Namespace_Module
Uninstall Module Using Command Line
php bin/magento deploy:mode:show
Check Current Mode Using Command Line
php bin/magento deploy:mode:set developer
Change To Developer Mode Using Command Line
php bin/magento deploy:mode:set production
Change To Production Mode Using Command Line
php bin/magento setup:di:compile
Uninstall Module Using Command Line
php bin/magento admin:user:unlock adminusername
Run the single-tenant Compiler Using Command Line
php bin/magento maintenance:enable
Enable Maintenance Mode Using Command Line
php bin/magento maintenance:enable --ip=192.0.0.1 --ip=192.0.0.2
To enable maintenance mode for all clients except 192.0.0.1 and 192.0.0.2:
php bin/magento maintenance:enable --ip=none
To clear the list of IPs.
php bin/magento maintenance:disable
Disable Maintenance Mode Using Command Line
php bin/magento maintenance:status
Check Maintenance Mode Status Using Command Line
php bin/magento maintenance:allow-ips --ip=192.0.0.1 --ip=192.0.0.2
Allow IP on Maintenance Mode Using Command Line
php bin/magento cron:install --force
Set Magento crontab Using Command Line
crontab -l
To view the crontab, enter the following command as the Magento file system owner.Use --force to rewrite an existing Magento crontab.
bin/magento config:show 
Shows configuration value for given path. If path is not specified, all saved values will be shown
bin/magento config:sensitive:set 
Sets any sensitive configuration value by its configuration path
bin/magento config:set 
Change system configuration

This is a comprehensive list of all useful Magento 2 commands; bookmark it for your future reference. Do comment below if you have any other handy commands which are not included in the list.

Thanks for reading!
Google+
Joomla TemplatesFree Joomla TemplatesVirtuemart TemplatesK2 TemplatesJoomShopping TemplatesHikaShop TemplatesSobiPro TemplatesOpenCart Themes
Quà Tết Cao Cấp Hộp quà tết Giỏ quà tết Túi quà tết