Last active
June 24, 2017 17:31
-
-
Save brahimmachkouri/d6875a7c988d366ba3802ed36519ead5 to your computer and use it in GitHub Desktop.
This script displays vagrant index_uuid for each VM created with Vagrant (macOS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
vms=$(vagrant global-status | awk -F " " '{ print $5 }' | grep Users) | |
for vm in $vms | |
do | |
if [ -d "$vm" ]; then | |
cat $vm/.vagrant/machines/default/virtualbox/index_uuid | |
echo " $vm" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is useful when you want to remove a vagrant box, but this box is still used by a VM. In this case, Vagrant informs you by displaying the VM uuid, but not its name. This script displays the corresponding VM name.