Cheat Sheet Vagrant¶
Show running Vagrant boxes¶
This command displays the status and information about all running Vagrant boxes on your system.Display SSH configuration for a Vagrant¶
Detroy all Vagrant boxezs¶
Environment¶
Start or create a Vagrant environment:
This command starts and provisions the Vagrant environment based on the Vagrantfile in the current directory.Stop a running Vagrant environment:
This command stops the running Vagrant environment by gracefully shutting down the Vagrant box.Destroy a Vagrant environment:
This command destroys the Vagrant environment, deleting the associated Vagrant box and all its resources.Suspend a running Vagrant environment:
This command suspends the Vagrant environment, saving its current state and allowing you to resume later.Resume a suspended Vagrant environment:
This command resumes a previously suspended Vagrant environment from its saved state.Reload a Vagrant environment:
This command reloads the Vagrant environment, applying any changes made to the Vagrantfile.Provision a running Vagrant environment:
This command re-runs the provisioning scripts specified in the Vagrantfile for the running Vagrant environment.Display status information about the Vagrant environment:
This command shows the status of the Vagrant environment, indicating whether it is running, suspended, or powered off.
SSH¶
SSH into a running Vagrant box:
This command connects to the default SSH user on the currently running Vagrant box using SSH.SSH into a specific Vagrant box:
If you have multiple Vagrant boxes defined in your Vagrantfile, you can specify the name of the box to SSH into a specific one.Execute a command on a running Vagrant box:
This command allows you to execute a specific command on the currently running Vagrant box without entering an interactive session. Replace "command" with the command you want to execute.Copy files to a running Vagrant box using SCP:
This command securely copies files from your local machine to the specified Vagrant box. Replace/path/to/local/file
with the path to the local file you want to copy,<vm-name>
with the name of the Vagrant box, and/path/to/destination
with the path on the Vagrant box where you want to copy the file.Copy files from a running Vagrant box using SCP:
This command securely copies files from the specified Vagrant box to your local machine. Replace<vm-name>
with the name of the Vagrant box,/path/to/remote/file
with the path to the file on the Vagrant box you want to copy, and/path/to/destination
with the path on your local machine where you want to copy the file.
Configuration changes¶
Reapply a Vagrant configuration to update an already-running Vagrant environment. This command will first halt the running virtual machines, then apply the new configuration changes, and finally restart the virtual machines. Keep in mind that vagrant reload only applies changes related to Vagrant's configuration, such as network settings, synced folders, or provider-specific settings.
If you want to reapply provisioning scripts or configuration management tools like Ansible, Puppet, or Chef, use the following command: