Magento 2: Command Line Commands

Magento 2 has cosole command line which is very useful for fast reindex or flush cache or admin user create, etc.. See below for the complete list of command line commands available on Magento 2.

Command Lists

Lists commands.

Usage:

php bin/magento --list

Create new Admin User

Creates an administrator

Usage:

 

php bin/magento admin:user:create –admin-firstname="FirstName" -admin-lastname="LastName" –admin-email="email@email.com" –admin-user="username" -admin-password="password"

Unlock an Admin User

Unlock Admin Account

Usage:

php bin/magento admin:user:unlock username

Cache Clean

Cleans cache type(s)

Usage:

php bin/magento cache:clean
php bin/magento cache:clean config
php bin/magento cache:clean layout
php bin/magento cache:clean block_html
php bin/magento cache:clean collections
php bin/magento cache:clean reflection
php bin/magento cache:clean db_ddl
php bin/magento cache:clean eav
php bin/magento cache:clean customer_notification
php bin/magento cache:clean target_rule
php bin/magento cache:clean full_page
php bin/magento cache:clean config_integration
php bin/magento cache:clean config_integration_api
php bin/magento cache:clean translate
php bin/magento cache:clean config_webservice

Cache Disable

Disables cache type(s)

Usage:

php bin/magento cache:disable
php bin/magento cache:disable config
php bin/magento cache:disable layout
php bin/magento cache:disable block_html
php bin/magento cache:disable collections
php bin/magento cache:disable reflection
php bin/magento cache:disable db_ddl
php bin/magento cache:disable eav
php bin/magento cache:disable customer_notification
php bin/magento cache:disable target_rule
php bin/magento cache:disable full_page
php bin/magento cache:disable config_integration
php bin/magento cache:disable config_integration_api
php bin/magento cache:disable translate
php bin/magento cache:disable config_webservice

Cache Enable

Enables cache type(s)

Usage:

php bin/magento cache:enable
php bin/magento cache:enable config
php bin/magento cache:enable layout
php bin/magento cache:enable block_html
php bin/magento cache:enable collections
php bin/magento cache:enable reflection
php bin/magento cache:enable db_ddl
php bin/magento cache:enable eav
php bin/magento cache:enable customer_notification
php bin/magento cache:enable target_rule
php bin/magento cache:enable full_page
php bin/magento cache:enable config_integration
php bin/magento cache:enable config_integration_api
php bin/magento cache:enable translate
php bin/magento cache:enable config_webservice

Cache flush

Flushes cache storage used by cache type(s)

Usage:

php bin/magento cache:flush
php bin/magento cache:flush config
php bin/magento cache:flush layout
php bin/magento cache:flush block_html
php bin/magento cache:flush collections
php bin/magento cache:flush reflection
php bin/magento cache:flush db_ddl
php bin/magento cache:flush eav
php bin/magento cache:flush customer_notification
php bin/magento cache:flush target_rule
php bin/magento cache:flush full_page
php bin/magento cache:flush config_integration
php bin/magento cache:flush config_integration_api
php bin/magento cache:flush translate
php bin/magento cache:flush config_webservice

Cache Status

Checks cache status

Usage:

php bin/magento cache:status

Catalog Image Resize

Creates resized product images based on the view.xml on the theme folder.

Usage:

php bin/magento catalog:images:resize

Product attribute cleanup

Removes unused product attributes.

Usage:

php bin/magento catalog:product:attributes:cleanup

Run Cron

Runs jobs by schedule

Usage:

php bin/magento cron:run
php bin/magento cron:run --group=index
php bin/magento cron:run --group=staging
php bin/magento cron:run --group=default
php bin/magento cron:run --group=catalog_event

 

Advertisements
Magento 2: Command Line Commands

Magento 2: Cannot create symlink, error code(1314)

The issue with the CSs/JS/Images not loading on the Magento2 frontend and admin side. I I I I have installed the Magento2 on xampp. The soultion for this is:

Open the xampp control with Administrator priviligies and start the Apache server, this solved the symlink problem with xampp and windows. Right click on the xampp icon and seklect the option “Run as Administrator”

REF: symlink(): Cannot create symlink, error code(1314) #81

Go to file app/etc/di.xml
Find out the below code part

Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

Replace this with below:

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

Magento 2: Cannot create symlink, error code(1314)