How to use the command 'VBoxManage' (with examples)
The command ‘VBoxManage’ is a command-line interface to VirtualBox that provides all the functionality of the GUI and more. It allows users to manage and control virtual machines using the command line. This article will illustrate several use cases of the ‘VBoxManage’ command and provide examples for each.
Use case 1: Display version
Code:
VBoxManage --version
Motivation: Displaying the version of VBoxManage is useful to ensure that the command is installed correctly and to verify the version of VirtualBox being used.
Explanation: The ‘–version’ option is used to display the version of VBoxManage.
Example output:
6.1.26r145957
Use case 2: Display help
Code:
VBoxManage --help
Motivation: The ‘–help’ option is useful when you need a quick reference for the available options and subcommands of VBoxManage. It provides a summary of the command and its subcommands.
Explanation: The ‘–help’ option is used to display a summary of VBoxManage and its available options and subcommands.
Example output:
Usage: VBoxManage [options]
Command-line management interface for VirtualBox.
Options:
--version display version information and exit
--help display this help and exit
...
Use case 3: Display help for a VBoxManage subcommand
Code:
VBoxManage --help subcommand
Motivation: The ‘–help’ option can also be used to obtain more detailed information about a specific subcommand of VBoxManage. This is useful when you need specific instructions on how to use a particular subcommand.
Explanation: Replace ‘subcommand’ with the desired VBoxManage subcommand, such as ‘startvm’, ‘clonevm’, ‘import’, ’export’, etc. The ‘–help’ option is then used to display detailed help information for that specific subcommand.
Example output:
Usage: VBoxManage startvm <uuid|vmname> [--type <gui|sdl|headless|separate|emergencystop>] [--defaultfrontend] ...
Thank you for using Oracle VM VirtualBox!
Starts a VM with a given UUID or name.
Options:
...
Use case 4: Execute a VBoxManage subcommand
Code:
VBoxManage subcommand
Motivation: The primary use of VBoxManage is to execute various subcommands to manage and control virtual machines. This can include starting, stopping, cloning, exporting, importing, and many other operations on virtual machines.
Explanation: Replace ‘subcommand’ with the desired VBoxManage subcommand to execute a specific operation on a virtual machine.
Example output: (execute the ’list vms’ subcommand)
"my_vm" {07c561d4-5678-4a32-9012-1234567890ab}
"another_vm" {12ab34cd-5678-9123-abcd-1234567890ef}
Conclusion:
In this article, we explored the various use cases of the ‘VBoxManage’ command. We learned how to display the version, get help, and execute subcommands for managing virtual machines. The command-line interface provided by VBoxManage offers a convenient way to control VirtualBox and its virtual machines, allowing users to automate and script various operations on their virtual infrastructure.