VirtualBox

VirtualBox Cheatsheet #

VirtualBox is an open-source virtualization software that allows you to run multiple operating systems simultaneously on a single machine. The VirtualBox CLI, known as VBoxManage, provides command-line access to all VirtualBox functionalities.

General Commands #

Command/OptionExampleDescription
VBoxManage –versionVBoxManage --versionDisplay the version of VirtualBox installed
VBoxManage list vmsVBoxManage list vmsList all virtual machines
VBoxManage list runningvmsVBoxManage list runningvmsList all running virtual machines
VBoxManage showvminfoVBoxManage showvminfo "VM name"Show detailed information about a virtual machine

VM Management #

Command/OptionExampleDescription
VBoxManage createvmVBoxManage createvm --name "MyVM" --registerCreate a new virtual machine
VBoxManage startvmVBoxManage startvm "MyVM" --type headlessStart a virtual machine in headless mode
VBoxManage controlvmVBoxManage controlvm "MyVM" poweroffPower off a virtual machine
VBoxManage unregistervmVBoxManage unregistervm "MyVM" --deleteUnregister and delete a virtual machine

VM Configuration #

Command/OptionExampleDescription
VBoxManage modifyvmVBoxManage modifyvm "MyVM" --memory 2048 --cpus 2Modify the configuration of a virtual machine
VBoxManage modifyvmVBoxManage modifyvm "MyVM" --nic1 bridged --bridgeadapter1 eth0Configure networking for a virtual machine
VBoxManage storagectlVBoxManage storagectl "MyVM" --name "SATA Controller" --add sata --controller IntelAhciAdd a storage controller to a virtual machine
VBoxManage storageattachVBoxManage storageattach "MyVM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium disk.vdiAttach a storage medium to a virtual machine

Disk Management #

Command/OptionExampleDescription
VBoxManage createhdVBoxManage createhd --filename disk.vdi --size 10000Create a new virtual hard disk
VBoxManage clonemediumVBoxManage clonemedium disk.vdi disk_clone.vdiClone a virtual hard disk
VBoxManage closemediumVBoxManage closemedium disk.vdi --deleteClose and delete a virtual hard disk

Snapshots #

Command/OptionExampleDescription
VBoxManage snapshotVBoxManage snapshot "MyVM" take "Snapshot1"Take a snapshot of a virtual machine
VBoxManage snapshotVBoxManage snapshot "MyVM" listList all snapshots of a virtual machine
VBoxManage snapshotVBoxManage snapshot "MyVM" restore "Snapshot1"Restore a virtual machine to a snapshot
VBoxManage snapshotVBoxManage snapshot "MyVM" delete "Snapshot1"Delete a snapshot of a virtual machine

Network Configuration #

Command/OptionExampleDescription
VBoxManage hostonlyif createVBoxManage hostonlyif createCreate a host-only network interface
VBoxManage hostonlyif ipconfigVBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0Configure the IP address of a host-only network interface
VBoxManage natnetwork addVBoxManage natnetwork add --netname natnet1 --network 10.0.2.0/24 --enable --dhcp onAdd a NAT network
VBoxManage natnetwork startVBoxManage natnetwork start --netname natnet1Start a NAT network

Miscellaneous #

Command/OptionExampleDescription
VBoxManage guestcontrolVBoxManage guestcontrol "MyVM" run --exe "/bin/bash" --username user --password passExecute a command in the guest operating system
VBoxManage setpropertyVBoxManage setproperty machinefolder /path/to/vmsSet the default folder for virtual machines
VBoxManage metrics collectVBoxManage metrics collect "MyVM" CPU/Load/UserCollect performance metrics for a virtual machine

This cheatsheet covers the most commonly used VirtualBox CLI commands and options, helping you to manage virtual machines, configure settings, handle disk management, snapshots, network configurations, and more effectively.

VirtualBox

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.