Skip to content

Instantly share code, notes, and snippets.

@microy
microy / virtualbox_cleanup.sh
Last active September 30, 2021 10:36 — forked from gsaslis/virtualbox_cleanup.sh
Bash script to cleanup Virtualbox VMs
#!/usr/bin/env bash
#
# Delete all the VMs in VirtualBox
#
for VM in $(VBoxManage list vms)
do
VM_ID=$(echo "${VM}" | awk '{print substr($2, 2, length($2) - 2)}')
VM_NAME=$(echo "${VM}" | awk '{print substr($1, 2, length($1) - 2)}')
echo "Deleting VM ${VM_NAME}..."