Vagrant Cheatsheet - VM Management
Vagrant's payoff is reproducibility: commit the Vagrantfile, and `vagrant up` rebuilds the same VM on anyone's laptop. The commands are short — up/ssh/halt/destroy — but the config points that bite are the box version, synced folders, and provisioner ordering. This table pairs the lifecycle commands with those Vagrantfile settings so a fresh clone goes from checkout to running VM in one command.
VM Lifecycle 9
vagrant init ubuntu/jammy64Initialize a Vagrant project
vagrant upStart the VM
vagrant sshSSH into the VM
vagrant haltShut down the VM
vagrant destroyDestroy the VM
vagrant suspend / vagrant resumeSuspend / resume the VM
vagrant reloadRestart and reload config
vagrant statusShow VM status
vagrant global-statusList all local Vagrant environments
Box Management 6
vagrant box add ubuntu/jammy64Download a box image
vagrant box listList installed boxes
vagrant box outdatedCheck for box updates
vagrant box update --box ubuntu/jammy64Update a specific box
vagrant box remove ubuntu/jammy64Remove a box image
vagrant box add my-box ./package.boxAdd 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\nendConfigure 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: 8080Port 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: trueDisable a sync folder
vagrant portShow port-forward mappings
Multi-Machine & Provision 6
config.vm.define "web" do |web|\n web.vm.box = "ubuntu/jammy64"\nendDefine the web machine
config.vm.define "db" do |db|\n db.vm.box = "ubuntu/jammy64"\nendDefine the db machine
vagrant up webStart a specific machine
vagrant ssh webSSH into a specific machine
vagrant provisionRe-run provisioning
vagrant provision --provision-with shellRun only a provisioner type
Snapshots & Plugins 7
vagrant snapshot save my-snapshotSave a snapshot
vagrant snapshot restore my-snapshotRestore a snapshot
vagrant snapshot listList all snapshots
vagrant snapshot delete my-snapshotDelete a snapshot
vagrant plugin install vagrant-vbguestInstall a plugin (auto Guest Additions)
vagrant plugin listList installed plugins
vagrant package --output my-box.boxPackage 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
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
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