Vagrant Cheatsheet - VM Management

All essential Vagrant commands organized by use case, with 40+ entries you can copy and run directly. Find the right command fast when you need it.

SysOps·40 commands·Last updated 2026-07-21
Back to SysOps

VM Lifecycle 9

vagrant init ubuntu/jammy64
Initialize a Vagrant project
vagrant up
Start the VM
vagrant ssh
SSH into the VM
vagrant halt
Shut down the VM
vagrant destroy
Destroy the VM
vagrant suspend / vagrant resume
Suspend / resume the VM
vagrant reload
Restart and reload config
vagrant status
Show VM status
vagrant global-status
List all local Vagrant environments

Box Management 6

vagrant box add ubuntu/jammy64
Download a box image
vagrant box list
List installed boxes
vagrant box outdated
Check for box updates
vagrant box update --box ubuntu/jammy64
Update a specific box
vagrant box remove ubuntu/jammy64
Remove a box image
vagrant box add my-box ./package.box
Add a box from a local file

Vagrantfile 6

config.vm.box = "ubuntu/jammy64"
Set the base box
config.vm.hostname = "dev-server"
Set the hostname
config.vm.provider "virtualbox" do |vb|\n vb.memory = "2048"\n vb.cpus = 2\nend
Configure VM resources
config.vm.synced_folder "./src", "/var/www"
Sync a folder
config.vm.provision "shell", path: "setup.sh"
Shell script provisioning
config.vm.provision "shell", inline: "apt-get update"
Inline shell provisioning

Network & Sync 6

config.vm.network "forwarded_port", guest: 80, host: 8080
Port forwarding
config.vm.network "private_network", ip: "192.168.33.10"
Private network (fixed IP)
config.vm.network "public_network"
Public network (bridged)
config.vm.synced_folder "./src", "/var/www", type: "nfs"
NFS sync (better performance)
config.vm.synced_folder "./data", "/data", disabled: true
Disable a sync folder
vagrant port
Show port-forward mappings

Multi-Machine & Provision 6

config.vm.define "web" do |web|\n web.vm.box = "ubuntu/jammy64"\nend
Define the web machine
config.vm.define "db" do |db|\n db.vm.box = "ubuntu/jammy64"\nend
Define the db machine
vagrant up web
Start a specific machine
vagrant ssh web
SSH into a specific machine
vagrant provision
Re-run provisioning
vagrant provision --provision-with shell
Run only a provisioner type

Snapshots & Plugins 7

vagrant snapshot save my-snapshot
Save a snapshot
vagrant snapshot restore my-snapshot
Restore a snapshot
vagrant snapshot list
List all snapshots
vagrant snapshot delete my-snapshot
Delete a snapshot
vagrant plugin install vagrant-vbguest
Install a plugin (auto Guest Additions)
vagrant plugin list
List installed plugins
vagrant package --output my-box.box
Package the VM into a box

Tips

  • vagrant up downloads the box on first run; later starts are fast.
  • Vagrantfile is Ruby, but only basic config is needed.
  • vagrant-vbguest auto-updates VirtualBox Guest Additions.
  • snapshot save/restore quickly persists/restores VM state.
  • NFS sync outperforms the default VBox shared folder for big projects.
  • vagrant package bundles a configured VM into a box for sharing.

Official References

Commands are compiled from the official docs below. Click to verify the latest usage.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us