There's nothing more annoying than making a change on Magento 2, flushing the cache, and then not seeing your change reflected. This super simple tool provides an easy way for you to purge Magento 2 in a safe, quick and convenient way.
This script empties the following Magento 2 directories:
pub/static/*
generated/*
var/cache/*
var/di
var/composer_home/*
var/generation/*
var/page_cache/*
var/view_preprocessed/*
And then flushes the cache using the built in Magento 2 CLI:
bin/magento cache:flush
It doesn't really matter where you are in your filesystem, as we will move the script to it's new home in step 3.
wget https://raw.githubusercontent.com/BenButterfield/m2purge/master/m2purge.sh
This allows a user to execute the script in an SSH terminal.
sudo chmod +x m2purge.sh
By moving the script here and changing the name, you allow it to be run from anywhere in your filesystem using shorthand.
sudo mv m2purge.sh /usr/local/bin/m2p
Navigate to your Magento 2 root directory and then run:
m2p