Oracle VirtualBox provides a very powerful command line utility – VBoxManage – to manage everything from the command line.
Listing VMs from command line Linux (Ubuntu)
To list VMs from the command line Ubuntu Linux VirtualBox host, run the below command:
VBoxManage list vms

Listing VMs from command line Windows
If you are using Windows as your VirtualBox host, you can run a similar command from a Windows command-line or PowerShell as follows.
cd "C:\Program Files\Oracle\VirtualBox"
.\VBoxManage list vms

These commands are helpful if you want to get VM names from a shell script or PowerShell script.
Related articles: