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!
# Starting a VM
vagrant up-- starts vagrant environment (also provisions only on the FIRST vagrant up)vagrant provision-- forces reprovisioning of the vagrant machinevagrant reload-- The equivalent of vagrant halt followed by vagrant upvagrant reload --provision-- Restart the virtual machine and force provisioning
# Getting into a VM
vagrant ssh-- connects to machine via SSHvagrant ssh boxname-- If you give your box a name in your Vagrantfile, you can ssh into it with boxname. Works from any directory.
# Stoping a VM
vagrant halt-- stops the vagrant machine
# Cleaning up a VM
vagrant destroy-- stops and deletes all traces of the vagrant machine- `vagrant destroy -f -- same as above, without confirmation
vagrant -v-- Get the vagrant versionvagrant status-- outputs status of the vagrant machine1vagrant global-status-- outputs status of all vagrant machinesvagrant suspend-- Suspends a virtual machine (remembers state)vagrant resume-- Resume a suspended machine (vagrant up works just fine for this as well)vagrant provision --debug-- Use the debug flag to increase the verbosity of the outputvagrant push-- Yes, vagrant can be configured to deploy code!vagrant up --provision | tee provision.log-- Runsvagrant up, forces provisioning and logs all output to a file
vagrant box list-- See a list of all installed boxes on your computervagrant box add-- Download a box image to your computer
# Plugins
- vagrant plugin hostsupdater :
$ vagrant plugin install vagrant-hostsupdaterto update your/etc/hostsfile automatically each time you start/stop your vagrant box.
# Database administration
- If you want to inspect your VM database directly from your local pgadmin, check this out !