How to list all VirtualBox available virtual machines from command line

In this article, we will explore various methods to list all available virtual machines (VMs) in VirtualBox using the command line. This will include techniques to list running, stopped, suspended VMs, their states, disk sizes, and more. Command line management of VMs is a powerful way to automate and streamline your virtualization tasks, especially for system administrators and power users.

In this tutorial you will learn:

  • How to list running VirtualBox VMs
  • How to list suspended VirtualBox VMs
  • Additional useful commands for VirtualBox VM management
How to list all VirtualBox available virtual machines from command line
How to list all VirtualBox available virtual machines from command line
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Linux or Windows with VirtualBox installed
Software VirtualBox
Other Basic understanding of command line operations
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Listing VirtualBox Virtual Machines from Command Line

To effectively manage your VirtualBox virtual machines, you can use the `VBoxManage` command, which is the primary command line tool for VirtualBox. Here are the steps and commands you can use to list various aspects of your VMs.

  1. Listing All VirtualBox VMs: To list all the available VMs in VirtualBox, whether they are running or not, you can use the following command:
    $ VBoxManage list vms

    This command will output a list of all VMs with their respective UUIDs and names.

    Listing All VirtualBox VMs
    Listing All VirtualBox VMs
  2. Listing Running VirtualBox VMs: To see which VMs are currently running, use:
    $ VBoxManage list runningvms

    This will show only the VMs that are currently in a running state.



  3. Listing Suspended VirtualBox VMs: Similar to listing stopped VMs, you need to compare states. Suspended VMs can be identified using:
    $ VBoxManage showvminfo "VM name" | grep -i "State"

    Check for the state showing “paused” or “saved” to determine if a VM is suspended.

  4. Listing VM Information: For comprehensive details about a VM, use:
    $ VBoxManage showvminfo "VM name"

    This will provide detailed information about the VM, including state, disk size, memory, and more.

Conclusion

Using the command line to manage your VirtualBox virtual machines can significantly enhance your productivity and allow for more flexible management scripts. The `VBoxManage` tool provides a rich set of options to list and control your VMs, making it an indispensable tool for VirtualBox users.



Comments and Discussions
Linux Forum