Skip to content

Instantly share code, notes, and snippets.

@tomysmile
Last active December 17, 2019 19:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomysmile/76cdb8aa90e1b6058cc7 to your computer and use it in GitHub Desktop.
Save tomysmile/76cdb8aa90e1b6058cc7 to your computer and use it in GitHub Desktop.
Vagrant: Shortcut command

Creating initial vagrant file

$ vagrant init

Running precise32

$ vagrant init hashicorp/precise32

Starting VM

$ vagrant up

Saving VM state and suspending execution (Take extra space and memory of the Host) - Has to be in the expected Vagrant directory

$ vagrant suspend

Resuming suspended VM - Has to be in the expected Vagrant directory

$ vagrant resume

Connecting (Headless Mode/No GUI) to Guest - Has to be in the expected Vagrant directory

$ vagrant ssh

Shutdown of VM (Save Disk and Memory) - Has to be in the expected Vagrant directory

$ vagrant halt

List of running Vagrant VMs

$ VBoxManage list vms

Force destroying VM (Save disk space)

$ vagrant destroy -f

Show help commands

$ vagrant -h

Reload / update vagrant file

$ vagrant reload

Run provisioning script

$ vagrant provision

Reload vagrant file and re-do provisioning

$ vagrant reload --provision

Check VM status on specific VM directory

$ vagrant status

List all downloaded boxes

$ vagrant box  list

Remove box

$ vagrant box remove [box-name]

Automatic rsync

$ vagrant rsync-auto

Runs the VM using Amazon Web Services as the Provider

$ vagrant up  --provider aws
$ vagrant up  --provider virtualbox

Install AWS plugin for vagrant

$ vagrant plugin install vagrant-aws

Add Dummy Box for Vagrant AWS

$ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box

List all existing vms in global cache

$ vagrant global-status --prune

Destroy specific machine with xxxxxxx uid from the global cache

$ vagrant destroy xxxxxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment