Shopping cart

How to Flush, Enable, Disable Cache Command Line in Magento 2

magento-2-tutorial
cache
featured
How to Flush Cache Command Line in Magento 2

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

I will explain cache management in this screenshot

Magento 2 Flush Cache Command Line

Magento 2 How to Flush Cache Command Line

How to flush Magento 2 cache

  • Go to Magento root directory

Flush Cache Storage

php bin/magento cache:clean

A short command line:

php bin/magento c:c

Flush Magento cache

php bin/magento cache:flush

A short command line:

php bin/magento c:f

How 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, I suppose that 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:


Magento CLI version 2

Usage:
 command [options] [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question

Available commands:
 help                                      Displays help for a command
 list                                      Lists commands
admin
 admin:user:create                         Creates an administrator
 admin:user:unlock                         Unlock Admin Account

cache
 cache:clean                               Cleans cache type(s)
 cache:disable                             Disables cache type(s)
 cache:enable                              Enables cache type(s)
 cache:flush                               Flushes cache storage used by cache type(s)

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

How to 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

Clean Cache command line

php bin/magento cache:clean

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

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, you should type command line

php bin/magento cache:disable CACHE_TYPE

Example:

php bin/magento cache:disable config

How to enable Cache command line

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

Enable all cache types

php bin/magento cache:enable

Enable specific cache type

php bin/magento cache:enable CACHE_TYPE

Example

php bin/magento cache:enable layout

Ref: Magento 2 user guide

PDF Invoice samples for Magento 2

mageplaza pdf invoice

Want to apply these above Invoice templates for your store?

See how

Please leave comments if you have any questions, feedbacks.

Comments for How to Flush, Enable, Disable Cache Command Line in Magento 2

You also may like these Magento 2 Extensions

One Step Checkout

$199
88 reviews

Layered Navigation

$99
51 reviews

SEO

FREE
32 reviews

Gift Card

$199
5 reviews

Reward Points

$149
4 reviews

Affiliate

$149
12 reviews

People also searched for:

  • Magento 2 Flush Cache Command flush
  • magento 2 clear cache command line
  • magento 2 empty cache command line
  • magento 2 clear config cache command line
  • magento 2 flush cache command line
  • magento 2 flush cache from command line
  • magento 2 clear cache from command line
  • magento 2 flush cache storage command line