· 1 min read · Dev-Sys

Halt all Vagrant/VirtualBox VMs one-liner

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

Next: Tip: keep Vagrant guest additions up to date.