Magento 2: How to Flush the Cache and Reindex from Command Line

You will first need to SSH into your server using an application like Terminal or Putty.

ssh -i /pathtokey/keyname.pem username@52.14.11.12

Once in, modify the user through this command:

sudo su -

This will give you the required permissions to run the commands below.

Navigate to the web root of your Magento installation. Typically the path to your Magento installation will look similar to this:

 /home/nginx/domains/yourdomainnamehere/pub/public/

You can use the cd (change directory) command to navigate to your Magento installation location.

The following commands below will enable you to flush your cache, flush your cache storage and reindex your Magento 2 database.

Run this commands to flush your Magento cache storage:

/usr/local/bin/php bin/magento cache:clean

Run this command to flush your Magento cache:

/usr/local/bin/php bin/magento cache:flush

Run this command to reindex your Magento 2 site:

/usr/local/bin/php bin/magento indexer:reindex

 

 

Was this article helpful?
0 out of 0 found this helpful