How to Enable, Disable Cache Command Line in Magento 2

How to flush Cache in Magneto 2 is general topic when you guys using Magento store. Magento 2 has 12 cache types by default. There are 5 simple command to manage cache in command line. In this post we will show you step by step each command line.


1. To flush Magento 2 cache

  • Go to Magento root directory
  • Type:php bin/magento cache:clean and php bin/magento cache:flush
  • Finish! Go to your Magento store and check result.

2. To change current directory in Ubuntu, Centos or Windows

  • Ubuntu: cd /var/www/magento2
  • CentOS: cd /var/www/html/magento2
  • Windows: cd /d/xampp/htdocs/magento2

In Windows case, you should install Xampp in D drive.

In Magento 2, let try to show command line guide by php bin/magento, it will show like this:


In this guide, we will talk more about Cache management in command line.

3. Check cache status

First of all, let show cache status by the following command line:

Php bin/magento cache: status

Result of cache status

Current status:
                        config: 1
                        layout: 1
                    block_html: 1
                   collections: 1
                    reflection: 1
                        db_ddl: 1
                           eav: 1
            config_integration: 1
        config_integration_api: 1
                     full_page: 1
                     translate: 1
             config_webservice: 1

4. Clean Cache command line

php bin/magento cache:clean

5. Flush cache storage used by cache types(s) command line

The cache storage may contain additional data such as server cache.

php bin/magento cache:flush

6. Disable Cache command line

The following command will disable all cache types

php bin/magento cache:disable

If you would like to disable specific cache type, should type command line

php bin/magento cache:disable CACHE_TYPE

7. Enable Cache command line

It is similar to Disable cache all types and specific cache type

Enable all cache types

php bin/magento cache:enable

Enable all cache types

php bin/magento cache:enable CACHE_TYPE

Next Article: Magento 2: How to create a Command Line Module

Let’s talk…

We just need a few basic details about you and the team will be in contact, if you already have a project in mind then just select yes below and provide a few details to get the ball rolling.

Do you have a project in mind already?


Speak to the team