Pragmatism in the real world

View status of all Vagrant environments

I’ve just upgraded to Vagrant version 1.6, and vagrant global-status is possibly my favourite new feature.

This command lists all currently up Vagrant environments wherever they may be on your computer:

$ vagrant global-status

id       name    provider   state   directory                                         
--------------------------------------------------------------------------------------
dbc7770  joindin virtualbox running /Users/rob/www/thirdparty/joindin-vm              
0683c7a  default virtualbox running /Users/rob/www/thirdparty/joindin-zs7 
 
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"

As you can see by the helpful information message, you can then pass the id to any of the usual Vagrant commands in order to work with that Vagrant install rather than changing directory first.

I tend to use this to halt VMs that I’ve left running by accident! i.e.

$ vagrant halt 0683c7a

All in all, a very useful feature!

One thought on “View status of all Vagrant environments

Comments are closed.