Vagrant Commands Cheat Sheet
This cheat sheet provides a quick reference for essential Vagrant commands, helping you manage your development environments efficiently. Vagrant is a tool for building and managing virtual machine environments in a single workflow.
Vagrant Environment Management
[main]
name = vagrant
desc = Vagrant cheats
[cheats]
starts vagrant environment (also provisions only on the FIRST vagrant up) = vagrant up
outputs status of the vagrant machine = vagrant status
stops the vagrant machine = vagrant halt
stops and deletes all traces of the vagrant machine = vagrant destroy
Suspends a virtual machine (remembers state) = vagrant suspend
Resume a suspended machine (vagrant up works just fine for this as well) = vagrant resume
Vagrant Provisioning and Reloading
restarts vagrant machine, loads new Vagrantfile configuration = vagrant reload
forces reprovisioning of the vagrant machine = vagrant provision
Restart the virtual machine and force provisioning = vagrant reload --provision
Use the debug flag to increase the verbosity of the output = vagrant provision --debug
Runs vagrant up, forces provisioning and logs all output to a file = vagrant up --provision | tee <FILENAME>
Vagrant Machine Interaction
connects to machine via SSH = vagrant ssh
Vagrant Global Status and Version
Get the vagrant version = vagrant -v
outputs status of all vagrant machines = vagrant global-status
same as above, but prunes invalid entries = vagrant global-status --prune
Vagrant Deployment
Yes, vagrant can be configured to deploy code! = vagrant push
For more in-depth information on Vagrant, refer to the official Vagrant documentation.