Remove ALL your local Vagrant Boxes via this bash command
Assuming you have only one box per provider, this command will delete ALL Vagrant boxes you currently have on your system:
$ vagrant box list | cut -f 1 -d ' ' | xargs -L 1 vagrant box remove -f
This command does the following:
vagrant box list
: Prints out a list of all installed vagrant boxes (with two columns—box name or path, and meta info)cut -f 1 -d ' '
: Cuts the list and takes out just the first column (using spaces to delimit the columns)xargs -L 1 vagrant box remove -f
: Usexargs
to run one command per line, running the commandvagrant box remove -f [box name from list/cut]
.
You can use xargs
' -t
option to output the commands being run just before they're executed. And if you have multiple boxes per provider, or if you have multiple versions of the same box, you'll likely need to modify the command a bit.