Halt all Vagrant/VirtualBox VMs one-liner

Posted in dev-sys on July 7, 2014

If you're using Vagrant to control your dev VMs on a headless server it's easy to lose track of the number of running machines.

Here's a one-liner to gracefully shut-down all of them to free up some resources.

for VM in `VBoxManage list runningvms | awk '{ print $2; }'`; do VBoxManage controlvm $VM poweroff; done

Comments (0)