VBoxManage control and manage Virtualbox from command line

Written by
Date: 2011-01-17 10:36:30 00:00

Spanish version


VirtualBox is according to developers:

VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL). See “About VirtualBox” for an introduction.

And according to Wikipedia:

Oracle VM VirtualBox is an x86 virtualization software package, originally created by software company innotek GmbH, purchased by Sun Microsystems, and now developed by Oracle Corporation as part of its family of virtualization products. It is installed on an existing host operating system; within this application, additional guest operating systems, each known as a Guest OS, can be loaded and run, each with its own virtual environment.

Supported host operating systems include Linux, Mac OS X, Windows XP, Windows Vista, Windows 7, Solaris, and OpenSolaris; there is also a port to FreeBSD (only OSE version). Supported guest operating systems include a small number NetBSD versions and various versions of Windows, Linux, DragonFlyBSD, FreeBSD, OpenBSD, OS/2 Warp, Solaris, OpenSolaris, Haiku, Syllable, ReactOS, and SkyOS.

From this, we may know that it is a powerful and useful tool, for those trying to test new Operating Systems, or try new configurations on Known Operating Systems. I use it a lot to test new Linux distribution, without the need to install them on my Hard Disk.

Another great use for it, is to have separated servers on the same hardware just to improve security, I mean: Why to have DNS server, FTP server, Web server and all others on the same environment, where an attack to one of these server may compromise all the others, you can install Linux on a good Hardware, and VirtualBox on it, and three or four different virtual machines running Linux to have all those functions mentioned before on different Virtual Machines, thus increasing the security of your configuration.

But, enough talking about this, this will be material of another article, let’s focus on how to manage VirtualBox from the command line, as you usually will do it from the GUI.

List virtual machines from command line

The command we will use for this is VBoxManage and different sub-commands it has, to list the virtual machines installed run:

 VBoxManage list vms

Oracle VM VirtualBox Command Line Management Interface Version 3.2.12
(C) 2005-2010 Oracle Corporation
All rights reserved.

"win7" {3f157880-c642-4be2-b641-85d7aedb5090}
"msn" {acc458d0-435b-44c7-806d-41c4948bb490}
"itunes" {41238c30-5f05-4fda-b008-5169d69505f6}
"Linux-Mint" {c25e1257-dfed-4789-a22b-8489c4d4df05}
"ubuntu" {fee70808-ab0e-473a-8991-d9b711773672}
"xp" {c75ec9b7-90b2-4f97-9e07-1267a3a03cb1}
"ubuntu-netop" {3d216ab8-3b44-46fd-8738-8c631801176e}
"slackware" {f65d5b26-6491-4523-8c06-970cbe6844d5}
"peppermint" {32b1845f-dd72-4c8a-bfe7-8cc3e83d0109}

If you specify -l then, you will get a detailed information about each one of those.

VBoxManage list vms -l

How to start virtual machines from command line

Now that you know which virtual machines are already installed, let’s see how to start them.

VBoxManage startvm "slackware"


VBoxManage startvm f65d5b26-6491-4523-8c06-970cbe6844d5

You can add those commands to your startup scripts, so virtual machines are started when you to boot your primary Linux server.

How to stop a virtual machine from command line

Now we know how to start virtual machines, we need to know how to stop them, there are some options.

Pause the virtual machine

This will just put the virtual machine on hold, until un-paused.

VBoxManage controlvm "slackware" pause

Resume the paused virtual machine

VBoxManage controlvm "slackware" resume

Reset -restart- the virtual machine

VBoxManage controlvm "slackware" reset

This will close the virtual machine, and restart immediately, you unsaved data on the virtual machine will not be saved, and will be lost! you have been warned.

Poweroff or shut down the virtual machine

VBoxManage controlvm "slackware" poweroff

This will poweroff the virtual machine, and once again any unsaved data will be lost.

Stop virtual machine, and save data

VBoxManage controlvm "slackware" savestate

This will save current state of the virtual machine and stop it, I think of this more or less, like hibernate the virtual machine.

Create a new virtual machine

You can also create new virtual machines from command line:

VBoxManage createvm -name "LinuxMint" -register

This create a new virtual machine, with default options.

Change Settings on the virtual machine from command line

Now we have a new virtual machine created, let’s change some of its default settings, like the allocated RAM:

VBoxManage modifyvm "LinuxMint -memory "1024MB"

Check the complete set of parameters


As you can see, VirtualBox is very flexible and fully managed from the command line, so it can be used on a Dedicated server, in a remote data center, and you may have all your virtual machines under control.

I’m not saying this is the best option to go for professional virtualization, but it is certainly a good one, and an easy one too.