How to list and start VirtualBox VMs in command line in Linux?

VirtualBox is a nice open source virtual machine software. It works nicely on Linux and is supported by many Linux distros like Ubuntu in their official package repositories, so it is quite easy to set it up on Linux. The VMs can also be managed in command line using the vboxmanage command line tool provided by VirtualBox. For VMs, the most common operations are possibly list, start and shutdown. Let’s check how to do these operations in the command line.

VirtualBox CLI

List VMs in VirtualBox

To list all VMs in VirtualBox, run

$ vboxmanage list vms

An example output

"centos7" {d6c938d8-0bec-57f0-9fd3-8e395ba3d218}

Start a VirtaulBox VM

Start the VM named centos7:

$ vboxmanage startvm centos7

An example output

Waiting for VM "centos7" to power on...
VM "centos7" has been successfully started.

List running VMs

$ vboxmanage list runningvms

It will show a list of VMs similar to list vms‘ output.

Shutdown a VM

To poweroff a VM named ‘centos7’,

$ vboxmanage controlvm centos7 poweroff

An example output

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Leave a Reply

Your email address will not be published. Required fields are marked *