6 useful VirtualBox commands to manage virtual machines

Virtualization is one of the core computing technologies today. With a virtual machine (VM), you can run almost any desired operating system on your PC without spending money on additional hardware.

This tutorial explores how to use the command line terminal in managing VirtualBox virtual machines, regardless of whether the operating system you are using is Windows, macOS, or Linux. All VirtualBox installations come with the command line tool VBoxManage, a powerful and flexible utility for managing virtual machines.

What is VboxManage?

VboxManage is a command line tool (CLI) that comes by default as part of the VirtualBox software installation.

You can manage most of your VMs from the GUI, VboxManage CLI gives you more functionality as it gives you direct access to the virtualization engine, allowing you to access additional features without available through the GUI. Also, most Linux servers don't come with a GUI, so you can still manage your virtual machines even in headless mode.

All VboxManage commands begin with the word vboxmanage and are usually followed by a subcommand such as list, controlvm, etc. Usually, you are asked to provide the name of the VM you want to configure or control.

6 useful VirtualBox commands to manage virtual machines

1. List virtual machines

One of the most common and important VirtualBox commands is to list all the virtual machines available on your PC or server. This is how you can view or list all the virtual machines that are registered on your PC. From the output you will notice that each virtual machine is assigned a unique identifier (UUID) that is used to identify a virtual machine.

To list the virtual machines installed on the computer, use the following command:

vboxmanage list vms

6 useful VirtualBox commands to manage virtual machines Picture 1

If you want a detailed list, add the -l or --long flag to the vms list vboxmanage command. The results show you all registered virtual machines and detailed information like configuration of each virtual machine, hardware details, settings, etc.

Sometimes you are only interested in listing the currently running VMs. In that case, you can use the list subcommand with the runningvms option as follows.

vboxmanage list runningvms

2. Start and stop a virtual machine

To start a virtual machine using VboxManage, use the startvm subcommand followed by the virtual machine name or UUID. For example, run the following command to start the virtual machine with the name Window11 listed in the previous section.

vboxmanage startvm Windows11

When it comes to stopping a virtual machine, you have several options available. You can shutdown the virtual machine or suspend it.

To stop a virtual machine by powering off, you use the controlvm subcommand followed by the name of the virtual machine and then the poweroff option as follows.

vboxmanage controlvm Windows11 poweroff

You will be shown the virtual machine shutdown progress in percentage.

If you want to prevent the virtual machine from consuming system resources but not necessarily shutting it down, you can pause the virtual machine and resume it later.

To suspend a running virtual machine, use the following command.

vboxmanage controlvm Window11 pause

Note that the suspended virtual machine is still listed in the running virtual machine. To get information about the state of a virtual machine, run a long list using the command:

vboxmanage list runningvms -l

In the output, the state parameter should be paused. Timestamps when the VM was paused will also be listed.

6 useful VirtualBox commands to manage virtual machines Picture 2

To resume a paused virtual machine, use the following command.

vboxmanage controlvm Windows11 resume

3. Get virtual machine information

To view information related to a specific virtual machine instead of listing all virtual machines, use the showvminfo subcommand. For example, you can run the following command to get detailed information about the Windows11 virtual machine, including hardware and other configuration details, network status, etc.

vboxmanage showvminfo Windows11

4. Create a virtual machine

Another important task when managing virtual machines is creating new virtual machines. Use the createeavm subcommand to create a new virtual machine. For example, to create a virtual machine named "DebianVM" running on the Debian Linux operating system, you can run the following command.

vboxmanage createvm --name DebianVM --ostype Debian Debian_64 --register

If you are unsure about the operating system name to use in your virtual machine, you can check the supported VirtualBox operating systems with the following command.

vboxmanage list ostypes

6 useful VirtualBox commands to manage virtual machines Picture 3

For example, if you want to modify the newly created virtual machine to change the memory size, name, and other relevant parameters, you can use the modvm subcommand.

Following the modvm subcommand syntax is the name of the virtual machine you want to modify. Next, you specify the setting you want to change, and finally the value of the setting.

Assume that you want to change the name of the newly created virtual machine above from DebianVM to Debian9 using the --name setting.

vboxmanage modifyvm DebianVM --name Debian9

You can see a list of settings that you can modify by running the command:

vboxmanage modifyvm

5. Snapshot and restore

Backups are an important component of maintaining a robust IT system. VirtualBox gives you the ability to keep the state of your virtual machine so you can restore it if something goes wrong.

To take a snapshot of a specific virtual machine, you can run the following command, where Christmas eve snapshot is the name given to your virtual machine snapshot.

vboxmanage snapshot Windows11 take "Christmas eve snapshot"

6 useful VirtualBox commands to manage virtual machines Picture 4

To restore the above virtual machine with the newly created snapshot, first stop the virtual machine if it is running, then restore the snapshot with the following command.

vboxmanage snapshot Windows11 restore "Christmas eve snapshot"

Obviously, you can convert the snapshot name to something else that matches your virtual machine settings.

6. Get help

To become better at using VboxManage CLI, you must know how to get help or read documentation from the terminal instead of memorizing commands. In addition, there are many other commands that have not been covered in this tutorial. Learn more about the VboxManage commands and the options it gives you by running the following command:

vboxmanage

This tutorial explored some important commands for managing VirtualBox virtual machines with VboxManage, a powerful and lightweight CLI tool. In addition, you can easily create automation scripts based on VboxManage to manage virtual machines easily.

Virtual machines give you the opportunity to run and experiment with multiple operating systems on your PC. Additionally, because the virtual machine runs in a secure and isolated environment, you can rest assured that if a client or virtual machine crashes, it won't negatively affect the host operating system.

5 ★ | 1 Vote

May be interested

  • Is VirtualBox safe or a security risk?Is VirtualBox safe or a security risk?
    virtualbox is a popular open source virtualization program used by individuals and businesses. if you've tried creating virtual machines on a windows or linux system, you've probably used this tool already.
  • Meet TPM 2.0 requirements, Windows 11 can work with VirtualBoxMeet TPM 2.0 requirements, Windows 11 can work with VirtualBox
    with the latest windows 11 beta channel 22000.194 build, microsoft has also added a trusted platform module (tpm) 2.0 requirement for virtual machines (vms).
  • How to run macOS on Windows 10 in a virtual machineHow to run macOS on Windows 10 in a virtual machine
    even if you are a loyal fan of microsoft and windows, it doesn't mean you can't use another operating system on windows. and the best way to do that is to use your current operating system and a virtual machine. in this tutorial, i will show you how to run macos on windows in a virtual machine.
  • How to transfer files between virtual machines and PCs on VMware and VirtualBoxHow to transfer files between virtual machines and PCs on VMware and VirtualBox
    copying files from virtual machine to local machine from host pc or vice versa is often the main problem for virtual machine users.
  • Monitor Hyper-V with the command line (Part 2): Basic monitoring commandsMonitor Hyper-V with the command line (Part 2): Basic monitoring commands
    in this article, we will learn how to access the virtual machine list and see general information about virtual machines with simple powershell statements. we will also look at stop commands and start virtual machines from the command window.
  • How to fix Ubuntu freezing in VirtualBoxHow to fix Ubuntu freezing in VirtualBox
    virtual machines are complex things and when something goes wrong, it's hard to know where the problem is. this is especially true if you are running ubuntu and it freezes continuously.
  • Learn about virtual machinesLearn about virtual machines
    virtual machines allow you to run different operating systems with the current operating system. operating systems will act as programs on a computer.
  • Installing Ubuntu in VirtualBox does not need DVD or USBInstalling Ubuntu in VirtualBox does not need DVD or USB
    in the previous tutorial, we presented some basic steps to install ubuntu in windows operating system with the option of dual boot using wubi. and this time, we will focus on using ubuntu as a virtual machine in virtualbox. the advantage of this process is that virtualbox does not require any boot components, besides that virtualbox and ubuntu are completely free.
  • How to Install VirtualBox on LinuxHow to Install VirtualBox on Linux
    setting up a virtual machine can be a great way to test alternative software or operating systems on a computer without altering or putting the existing system at risk.
  • Stealing virtual machines and virtual machine dataStealing virtual machines and virtual machine data
    there are basically two ways to access a virtual disk file (.vmdk) of a virtual machine, which is using the esx service console or vsphere / vmware infrastructure client with a built-in data warehouse browser.