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 start with vboxmanage and is usually followed by a subcommand like list, controlvm, etc. Usually, you are asked to provide the name of the VM that 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.

See more:  How to use Power Automate on Windows 11 to automate tasks

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

vboxmanage list vms
Output shows virtual machines registered on PC or server
Output shows virtual machines registered on PC or server

If you want a detailed list, add flag -l or –long enter the order vms list vboxmanage. 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 option runningvms as follows.

vboxmanage list runningvms

2. Start and stop a virtual machine

To start a virtual machine using VboxManage, use the subcommand startvm followed by the virtual machine name or UUID. For example, run the following command to start the virtual machine with the name Windows11 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 it off, you use the subcommand controlvm followed by the name of the virtual machine and then the option poweroff 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.

See more:  Windows 11 can run Android apps without installing emulators
Command output showing the status of a virtual machine
Command output showing the status of a virtual machine

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 subcommand showvminfo. 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 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
List of supported operating systems
List of supported operating systems

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 subcommand modvm.

Following the subcommand syntax modvm 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.

Suppose that you want to change the name of the newly created virtual machine above from DebianVM Fort Debian9 using settings –name.

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.

See more:  Spiderman No Way Home Wallpaper, Spiderman No Way Home images

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"
Quickly record the state of the virtual machine
Quickly record the state of the virtual machine

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.

Source link: 6 useful VirtualBox commands to manage virtual machines
– https://techtipsnreview.com/

, , , ,

Leave a Reply

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