You are on page 1of 4

(https://mageprince.

com/blog/)

Home (http://mageprince.com/blog/) Magento 2 (https://mageprince.com/blog/category/magento2/) Github (https://github.com/mageprince)

About (https://mageprince.com/blog/about/) Contact (https://mageprince.com/contact) 

SEARCH
When you should run which commands
Search
in Magento 2?
FOLLOW ME
 Prince Patel (https://mageprince.com/blog/author/secure_parth/) -  October 25, 2019 -
 Magento 2 (https://mageprince.com/blog/category/magento2/) - Follow
Like
 1 Comment (https://mageprince.com/blog/when-you-should-run-which-commands-in-magento-
2/#disqus_thread)

I often see that many new Magento developer run setup upgrade command
every time when they changed something from js or HTML. MODULES ON MAGENTO
MARKETPLACE

In this article, I will discuss about which changes need which commands to  Magento 2 - Product Attachment
reflect changes on the frontend or backend of Magento 2. (https://marketplace.magento.com/prince-
module-productattachment.html)
 Magento 2 - Extra Fee
1) php bin/magento setup:upgrade
(https://marketplace.magento.com/prince-
magento2-extrafee.html)
Short Form: php bin/magento set:up  Magento 2 - Extra Fee Pro
(https://marketplace.magento.com/prince-
You should run this command only on following senarios magento2-extrafeepro.html)
 Magento 2 - FAQ
(https://marketplace.magento.com/prince-
When you made changes in the Setup script(InstallData, InstallSchema,
module-faq.html)
UpgradeData, UpgradeSchem)  Magento 2 - Payment Fee
When you install a new module (https://marketplace.magento.com/prince-
When you change setup_version in module.xml magento2-paymentfee.html)

After upgrade Magento version


GITHUB MODULES
2) php bin/magento setup:static-content:deploy
 Magento 2 - FAQ
(https://github.com/mageprince/magento2-
Short Form: php bin/magento s:s:d
FAQ)
 Magento 2 - BuyNow
You need to run this command only when you made changes in HTML, CSS, (https://github.com/mageprince/magento2-
JS… buynow)
 Magento 2 - Payment Fee
If you are in developer mode and enabled symlinks in system you need not (https://github.com/mageprince/magento2-
paymentfee)
run this command. If disabled symlinks, need to delete particular changed
 Magento 2 - AdminLogs
files from pub/static folder. (https://github.com/mageprince/magento2-
adminlogs)
3) php bin/magento setup:di:compile

RECENT POSTS
Short Form: php bin/magento s:d:c
How to insert multiple records into a
If you made changes like add new dependency in __construct(), changes table without a model?
in di.xml , Add new controller… (https://mageprince.com/blog/how-to-
insert-multiple-records-into-a-table-
without-a-model/)
If you are in developer mode you can simply delete changed files
from var/generation folder for Magento 2.2.x version and /generated folder How to Get Product Salable Quantity
By Stock Id in Magento 2
for Magento 2.3.x (https://mageprince.com/blog/how-to-
get-product-salable-quantity-by-
4) php bin/magento cache:flush stock-id-in-magento-2/)

How to compress sales PDF size in


Short Form: php bin/magento c:f Magento 2
(https://mageprince.com/blog/how-to-
You need to run this command, If you made changes in admin compress-sales-pdf-size-in-magento-
2/)
configuration, layout xml, ui component, phtml, … file or overrite html, js
How to increase file upload size in
in frontend theme.
PHP
(https://mageprince.com/blog/how-to-
Here is the list of caches in Magento 2 increase-file-upload-size/)

How to show source in shipment grid


1. Configuration: After adapting configuration files, it is necessary to flush
Magento 2 MSI
them including configuration and store specific settings (https://mageprince.com/blog/how-to-
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
2. Layouts: After adapting layout files, it is necessary to flush them including show-source-in-shipment-grid-
OK magento-2-msi/)
the compiled page layout from all components
3. Blocks HTML output: After adapting the view layers, it is necessary to How to Create Shipment
flush them including page fragments per block Programmatically with Source
Selection MSI Magento 2
4. Collections Data: By Magento, it can flush automatically database (https://mageprince.com/blog/how-to-
queries. However, Custom modules may write entries which make Magento create-shipment-programmatically-
with-msi-magento-2/)
can not clean by itself, in case, Magento can not clean so we need to
clean the cache How to Add Custom Mass Action in
Order Grid in Magento 2
5. Reflection Data: API interfaces reflection data will be flushed (https://mageprince.com/blog/how-to-
Database DDL operations: it can be flush automatically by Magento, but add-custom-mass-action-in-order-
grid-in-magento-2/)
3rd party can plus more data, after making custom changes to the
database schema, which can clean the cache How to get source by shipment Id in
Magento 2 MSI
6. EAV types and attributes: The metadata regarding the entity attributes
(https://mageprince.com/blog/how-to-
into the cache, in general, it should not flush the cache get-the-source-by-shipment-id-in-
7. Integrations Configuration: Caches the compiled integrations on your magento-2-msi/)

store. Clean after adding new or changing existing integrations A QUICK WAY to print log or data in
8. Integrations API Configuration: Compiled integration APIs configuration any PHP file in Magento 2
(https://mageprince.com/blog/a-
of the Store’s Integrations quick-way-to-print-log-or-data-in-
9. Page Cache: This cache links the HTML pages so it is necessary to clean any-php-file-in-magento-2/)

this type of cache regularly How to get category by url key in


10. Translations: After merging translations from all modules, the merger Magento 2
(https://mageprince.com/blog/how-to-
cache will be cleaned get-category-by-url-key-in-magento-
11. Web Services Configuration: Caching the Web API Structure 2/)

Here is the list of commands in Magento 2


SUBSCRIBE TO BLOG

Enter your email address to


Common Useful commands:
subscribe to this blog.

Setup Upgrade: php bin/magento setup:upgrade Your email address

If you want pub/static files while installing or updating database then


use following command: SUBS C R I BE

php bin/magento setup:upgrade --keep-generated


Static Content Deploy(use -f for force deploy on 2.2.x or later):
php bin/magento setup:static-content:deploy
Static Content Deploy For Particular Language:
php bin/magento setup:static-content:deploy en_US
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/backend"
Static Content Deploy For Specific Themes (Working on 2.1.1 or later)
php bin/magento setup:static-content:deploy --theme Magento/luma --theme
Magento/another_theme
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 setup:static-content:deploy en_US --exclude-theme
Magento/luma --no-html-minify
Reindex data: php bin/magento indexer:reindex
View the list of indexers: php bin/magento indexer:info
View indexer status: php bin/magento indexer:status
Show the mode of all indexers: php bin/magento indexer:show-mode

Cache related commands:

Cache Clean: php bin/magento cache:clean


Cache Flush: php bin/magento cache:flush
View cache status: php bin/magento cache:status
Enable Cache: php bin/magento cache:enable [cache_type]
Disable Cache: php bin/magento cache:disable [cache_type]

Modes related commands:

Check Current Mode: php bin/magento deploy:mode:show


Change To Developer Mode: php bin/magento deploy:mode:set developer
Change To Production Mode: php bin/magento deploy:mode:set production

Module
We related commands:
use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

OK
See all modules Status: php bin/magento module:status
Enable module: php bin/magento module:enable Namespace_Module
Disable module: php bin/magento module:disable Namespace_Module
Uninstall Module: php bin/magento module:uninstall Namespace_Module

Site Maintenance Related Commands:

Enable Maintenance Mode: php bin/magento maintenance:enable


To enable maintenance mode for all clients except 10.10.16.1 and
10.10.16.2: php bin/magento maintenance:enable --ip=10.10.16.1 --
ip=10.10.16.2
To clear the list of IPs: php bin/magento maintenance:enable --ip=none
Disable Maintenance Mode: php bin/magento maintenance:disable
Check Maintenance Mode: php bin/magento maintenance:status
Allow IP on Maintenance Mode: php bin/magento maintenance:allow-ips --
ip=192.0.0.1 --ip=192.0.0.2

Other Commands:

Run the single-tenant Compiler: php bin/magento setup:di:compile


Unlock Admin User: php bin/magento admin:user:unlock adminusername
Set Magento crontab: php bin/magento cron:install --force Use --force to
rewrite an existing Magento crontab.
To view the crontab, enter the following command as the Magento file
system owner. crontab -l
Remove Magento crontab: php bin/magento cron:remove

Thank you for reading. Happy coding…!

TAGS: CLI COMMAND (HTTPS://MAGEPRINCE.COM/BLOG/TAG/CLI-COMMAND/), MAGENTO 2


(HTTPS://MAGEPRINCE.COM/BLOG/TAG/MAGENTO-2/)

PLEASE SHARE THIS

%20Magento%202%3F&url=https%3A%2F%2Fmageprince.com%2Fblog%2Fwhen-
l)

ct+changes+on+the+frontend%26hellip%3B&source=https://mageprince.com/blog/)
(whatsapp://send?text=https%3A%2F%2Fmageprince.com%2Fblog%2Fwhen-
you-should-run-which-commands-in-magento-2%2F)
(viber://forward?
text=https%3A%2F%2Fmageprince.com%2Fblog%2Fwhen-
you-should-run-which-commands-in-magento-2%2F)
ww.tumblr.com/widgets/share/tool?
Url=https%3A%2F%2Fmageprince.com%2Fblog%2Fwhen-you-should-run-which-
-in-magento-2%2F)

 Previous Post Next Post 


How to validate forms in Magento 2? How to get a formatted price with
(https://mageprince.com/blog/how- currency in phtml file in Magento 2
to-validate-forms-in-magento-2/) (https://mageprince.com/blog/how-
to-get-a-formatted-price-with-
currency-in-phtml-file-in-magento-
2/)

 YOU MIGHT ALSO LIKE

How to insert
multiple
records into a
(https://mageprin
table without a
ce.com/blog/crea (https://mageprin
model?
te-short-forms-of- ce.com/blog/work (https://magepr
magento-2- -with-html-and-js- ince.com/blog/
commands-in- in-magento-2/) how-to-insert-
multiple-
linux/)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
Work with records-into-a-
HTML and JS OK table-without-
in Magento 2 a-model/)
(https://mageprin Create short (https://magepr  January 24, 2022

ce.com/blog/how- forms of ince.com/blog/


Magento 2 work-with-
to-add-custom-
commands in html-and-js-in-
mass-action-in- Linux magento-2/)
order-grid-in- (https://magepr  November 16, 2019
magento-2/) ince.com/blog/
create-short-
How to Add forms-of-
Custom Mass magento-2-
Action in Order commands-in-
Grid in linux/)
Magento 2
 April 23, 2020
(https://magepr
ince.com/blog/
how-to-add-
custom-mass-
action-in-
order-grid-in-
magento-2/)
 September 12, 2020

1 Comment  Syed Sarfraz Ali

⚠ MagePrince requires you to verify your email address before posting. Send verification email to ×
fraz_intel@rocketmail.com

Join the discussion…

Sort by Best  ⥅

ankit21ks • a year ago


Very helpful, all commands are at one place, useful for beginner
△ ▽ • Reply • Share ›

✉ Subscribe 🔒 Privacy ⚠ Do Not Sell My Data

 
(https://github.com/mageprince) (http://www.copyscape.com/)
(https://www.facebook.com/themageprince/)


(https://www.instagram.com/mageprince/)


(https://in.linkedin.com/in/princepatel)


(https://twitter.com/_mageprince)

Copyright 2020 - Mageprince

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

OK

You might also like