Destroying all your Vagrant Boxes

Destroying all your Vagrant Boxes

TLDR; for vb in `vagrant global-status | grep virtualbox | awk '{ print $1 }'` ; do vagrant destroy $vb ; done I've been playing around with Vagrant a lot recently and in doing so I've ended up with lots of unused vagrant boxes on my machine. I could go and delete them all individually but it seemed a good oppertunity to learn some scripting. Stage One - Finding all the Vagrant Boxes Vagrant has a command that allows you to list all the vagrant machines currently on your computer, vagrant global-status: $ vagrant global-status id name provider state directory ------------------------------------------------------------------------------- 1e4d043 acs virtualbox running…

Read More