My ‘Fix All’ One Liner Command for Magento 2

We as Developers run into issues with Magento 2 – a lot. Clear cache, reindex, regenerate static files, enable modules etc. etc. the list goes on. So I made it simple – I made a one-liner command you can copy paste into your SSH terminal that attempts to do all of these things in 1 go.

I use a –keep-generated flag because I’ve noticed Magento losing all of the static files while generating static files – meaning your site will go down! I am not sure if anyone else has noticed that. But the flag protects me from that behaviour.

I generally run this command after installing a module, or making big changes to the theme, or when Magento’s not really running as it should. Here it is:

The multiple –language params reflect my needs – I generally have clients in Australia so I need en_AU but en_US seems quite mandatory most of the cases so even though it takes almost twice as long, I need to generate these local copies.

Let me in the comments know how you go and/or if you have issues running this a particular Magento version!

Write a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.