Use command line to create, list, start & stop VirtualBox VMs

If you want to use the command line terminal tool vboxmanage to create, deleted, list, start or stop VirtualBox Virtual Machines, here is the tutorial to follow…

VirtualBox is open-source software available to install on all popular operating systems. It also supports Linux and in systems like Ubuntu, Manjaro, and more you can install it directly from the official repository. Although Virtualbox comes with a graphical user interface to control created virtual machines, still, if you want, can use its vboxmanage tool in the command terminal to manage VMs.

Here we will let you know how to use the VboxManage command tool to start, stop and list VirtualBox virtual machines on Linux, Windows, or macOS.

However, for this tutorial we are using Linux, you can use the commands on other OS as well.

Note: You must have VirtualBox installed on your Linux and other systems to run the below commands… However, Windows 10/8/7 users, first need to add the VirtualBox folder in their system or home environment path. For that run:

Using Command prompt-

SET PATH=%PATH%;C:\Program Files\Oracle\VirtualBox

Via Powershell-

$env:PATH = $env:PATH + ";C:\Program Files\Oracle\VirtualBox"


VBoxManage Virtualbox commands to manage VMs

Command to Create VirtualBox virtual machine

Replace the H2SVM with whatever name you want to give your Virtual machine.

VBoxManage createvm --name H2SVM --register

To Set type Linux and version 64-bit

VBoxManage modifyvm H2SVM --ostype Linux_64


VBoxManage modifyvm H2SVM --memory 1024 --vram 16

Assign the Number of CPU cores

VBoxManage modifyvm H2SVM  --cpus 2

Create Virtual storage and set size for it

VBoxManage createhd --filename H2SVM.vdi --size 32768

Add Storage controller and attach hard disk + ISO Image to boot.

VBoxManage storagectl H2SVM--name "SATA Controller" --add sata --controller IntelAHCI

VBoxManage storageattach H2SVM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium H2SVM.vdi

VBoxManage storageattach H2SVM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "/home/how2shout/tails-amd64-4.16.iso"

Note: Change the ISO file path in the above command

Set Boot order

VBoxManage modifyvm H2SVM --boot1 dvd --boot2 disk --boot3 none --boot4 none

Set Network NAT

VBoxManage modifyvm H2SVM --nic1 nat --nictype1 82540EM

For Bridge Network, use-

VBoxManage modifyvm H2SVM--nic1 bridged --nictype1 82540EM --bridgeadapter1 wlx000b819609d3

Turn on Physical Address Extension

VBoxManage modifyvm H2SVM --pae on


Command to List Virtual Machines

To know what is the number of virtual machines created on Virtualbox so far using command terminal, type-

vboxmanage list vms

Output: As per the available VMs, the command will show something like below:

"CentOS" {694b1226-4592-49c2-bcd0-ebb79efc8598}
"Ubuntu " {5644b8dd-ab01-46be-9265-404df4325c6b}
"WIndows 10" {abacf56d-60ee-4f88-bc35-b377964758ca}
"H2SVM" {70285447-ff88-4f32-801c-8a72190b9a89}


Start VirtualBox VM via command

Now, we already have a list of all available virtual machines. So, if we want to start any of them, just type-

vboxmanage startvm virtualmachine-name

Replace virtual machine-name with the one you want to Power ON.

For example, in our list of all VMs, we have one- H2SVM. To start that VM using the above command, it will be like this-

vboxmanager startvm H2SVM

To run headless-

VBoxManage startvm H2SVM --type headless


Stop Virtual machine using command

To power off some already running VirtualBox VM, we can directly use our command terminal, and to do that run-

vboxmanage controlvm VM-name poweroff 

Replace VM-name with the running machine you want to stop.

For example, if you consider H2SVM as the running VM on VirtualBox. Thus, to stop it using the command terminal, we need to type-

vboxmanage controlvm H2SVM poweroff


List all running VMs

In case you are not sure which VMs are running so that you can turn them off using your terminal, issue a command-

vboxmanage list runningvms


Remove VM

VBoxManage storageattach H2SVM--storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium none
VBoxManage closemedium disk H2SVM.vdi --delete
VBoxManage unregistervm H2SVM --delete

Note: Replace H2SVM with the Virtual machine name that you want to remove


Convert VDI / VMDK / VHD

To Convert one virtual hard disk type to another

VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage clonehd "source.vhd" "cloned.vmdk" --format vmdk
# RAW image to vdi
VBoxManage convertfromraw "source.hddimg" "cloned.vdi" --format vdi

Note: Replace source.xx with fie you want to convert and also can change cloned.xx with whatever you name you to want to give your converted virtual disk.


Resize virtual disk (resize in MB, here 256 GB)

Many times after installing OS in the virtual machine we need to expand the size of its virtual hard disk. For that, we can use the below command. Navigate to the folder where you have the virtual hard disk file for your virtual machine and then run the below command:

VBoxManage modifyhd "HDD.vdi" --resize 36000

Replace HDD.vdi with your virtual disk file name that size you want to increase. The size will be in MB, for example, 36000 given in the command, in GB it will be 360GB.

To know more about this command tool visit the official manual page.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.