Magento Commands

0





 Most Used Commands Magento 2

--------------------------------------


php bin/magento cache:clean 

php bin/magento cache:flush

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento indexer:reindex

php bin/magento module:status 

php bin/magento module:enable vendorname_modulename

php bin/magento module:disable vendorname_modulename

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


======for create db_schema_whitelist.json======

php bin/magento setup:db-declaration:generate-whitelist --module-name Dolphin-Practice


--------------------------------------

Magento 2 accesskey from marketplace.

username:  123

password:  123

--------------------------------------

--------------------------------------

ssh pc-27@yourip

pass

cd /var/www/html/HyvaTheme/

php bin/magento your_command

--------------------------------------

--------------------------------------

grep -r 'string' vendor/

grep -Ril string

grep -R --include="*.xml" "string"

--------------------------------------


============linux commands ============

cheak current dir = pwd

list all files of current dir = li

change directory = cd

back dir = cd..



============ magento commands ============ <magento_root>/bin/magento <command name>


sudo systemctl restart elasticsearch.service == Elasticsearch


php bin/magento --version


php bin/magento setup:upgrade == command is used to update the Magento database schema and data, as well as apply any necessary system upgrades


php bin/magento setup:upgrade --keep-generated ==  don't want to remove pub/static files while installing/updating database 


php bin/magento cache:clean == Cache Clean Using Command Line


php bin/magento cache:clean cache_type == Cache cleaning with specific type (configration,layout,html block,page cache etc)


php bin/magento cache:flush == Cache Flush Using Command Line


php bin/magento cache:enable/disable  [cache_type] == Enable/Disable Cache Using Command Line


php bin/magento cache:disable cache_type == Disable cache with specific type (configration,layout,html block,page cache etc)


php bin/magento <-f> 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 list == lists all available installation and configuration commands


php bin/magento indexer:reindex == reindexing database schema


-----------------------------------------

php bin/magento indexer:info == View the list of indexers Using Command Line

Category Product Index (Catalog Module)

Price Index (Catalog Module)

EAV Index (Catalog Module)

Stock/Product Index (CatalogInventory Module)

-----------------------------------------


-----------------------------------------

php bin/magento indexer:status == View indexer status Using Command Line

Magento 2 Indexer status can be divided into three different types depending on whether an index data is up to date:

Valid: Data is synchronized and no need to reindex.

Invalid: Data is modified and needs to be reindexed.

Working: the reindex is in progress.

-----------------------------------------


-----------------------------------------

php bin/magento indexer:show-mode == Show the mode of all indexers Using Command Line

There are 2 modes for Magento 2 indexers:

Update on save and Update by schedule.

In which: Real time: selected indexers -> index is updated immediately after data is changed (Update on save).

Schedule: selected indexers -> index is updated according to the cron job schedule (Update by schedule)

-----------------------------------------


php bin/magento module:status == See all modules Status Using Command Line


php bin/magento module:enable/disable Namespace_Module(vendorname_modulename) == Enable/Disable module Using Command Line


php bin/magento module:uninstall Namespace_Module == Uninstall Module Using Command Line


php bin/magento deploy:mode:show (default,devloper,production) == Check Current Mode Using Command Line


php bin/magento deploy:mode:set developer/production == Change To Developer/Production Mode Using Command Line


-----------------------------------------

php bin/magento setup:di:compile == Run the single-tenant Compiler Using Command Line

Use this command if you have one website and store. If you have multiple websites and stores, use the multi-tenant compiler instead.

-----------------------------------------


php bin/magento admin:user:unlock adminusername == Unlock Admin User Using Command Line


php bin/magento maintenance:enable/disable == Enable/Disable 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:status == Check Maintenance Mode Status Using Command Line(Enable?/Disable?)


-----------------------------------------(crontab commands)

php bin/magento cron:install --force == Set Magento crontab Using Command Line (Use --force to rewrite an existing Magento crontab)


crontab -l == To view all the current crontab


php bin/magento cron:remove == Remove Magento crontab Using Command Line

-----------------------------------------


php bin/magento setup:uninstall == Uninstalling the Magento application


php bin/magento store:website/store:list == Display the list of websites/stores


php bin/magento catalog:product:attributes:cleanup == Removes unused product attributes


php bin/magento module:enable/disable VendorName_ModuleName == Enable/Disable module 


php bin/magento setup:backup == Take a backup of Magento Application code base, media, and database


php bin/magento info:timezone/language/currency/backups:list == Display the list of available data



============ magento commands ending ============ 


============ apache elasticsearch commands ============ 


sudo systemctl restart elasticsearch.service

sudo nano  /etc/elasticsearch/elasticsearch.yml

sudo service elasticsearch status


============ apache commands ============ 


sudo chmod -R 777 /var/www/html/m246

sudo service apache2 restart












Post a Comment

0Comments
Post a Comment (0)
To Top