Skip to content

Instantly share code, notes, and snippets.

@wikijm
Forked from wpscholar/vagrant-cheat-sheet.md
Created November 12, 2015 17:55
Show Gist options
  • Save wikijm/723bd91353c6c8369edd to your computer and use it in GitHub Desktop.
Save wikijm/723bd91353c6c8369edd to your computer and use it in GitHub Desktop.
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Common Vagrant Commands

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
  • vagrant status -- outputs status of the vagrant machine
  • vagrant halt -- stops the vagrant machine
  • vagrant reload -- restarts vagrant machine, loads new Vagrantfile configuration
  • vagrant provision -- forces reprovisioning of the vagrant machine
  • vagrant ssh -- connects to machine via SSH
  • vagrant destroy -- stops and deletes all traces of the vagrant machine

Tips

  • vagrant -v -- Get the vagrant version
  • vagrant global-status -- outputs status of all vagrant machines
  • vagrant suspend -- Suspends a virtual machine (remembers state)
  • vagrant resume -- Resume a suspended machine (vagrant up works just fine for this as well)
  • vagrant reload --provision -- Restart the virtual machine and force provisioning
  • vagrant provision --debug -- Use the debug flag to increase the verbosity of the output
  • vagrant push -- Yes, vagrant can be configured to deploy code!
  • vagrant up --provision | tee provision.log -- Runs vagrant up, forces provisioning and logs all output to a file

Notes

  • If you are using VVV, you can enable xdebug by running vagrant ssh and then xdebug_on from the virtual machine's CLI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment