1

What are the cache directories of Magento 2 ?

I just need to remove those with my rm -rf command, without executing Magento cache:flush command.

4 Answers 4

3

Either u can manually delete folders or using this command

rm -rf var/cache/ generated/code pub/static/frontend pub/static/adminhtml

After that you need to run these commands again , else the css/styles in magento frot-end and back-end won't load

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento setup:di:compile
sudo chmod -R 777 var/ pub/ generated/
1
  • After remove folder, need to run setup:upgrade! why ?
    – Pawan
    Feb 28, 2020 at 4:15
1

You need to remove these directories

<magento_root>/var/cache/* 
<magento_root>/var/page_cache/* 
<magento_root>/generated/metadata/* 
<magento_root>/generated/code/*

for more information please follow this link: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/partial-caching/database-caching.html

1

So do you want to remove cache files ? If yes, then remove these folders:

/var/cache

/var/page_cache

Simply remove this folders.

0

rm -rf var/cache/ generated/ pub/static/ var/page_cache var/view_preprocessed

1
  • you need to add more context to your answer, also please let us know what extra info you added in separate answer then the accepted one Apr 15 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.