Useful Virtualbox Command Log into your host server using ssh. Get a list of all VMs. $ VBoxManage list vms Start a guest VM named mywiki with RDP enabled and listening on port 3390. If you plan to run multiple guest VMs in headless mode with RDP enabled, you will need to choose a unique port for each to listen on. If you don’t specify a port, the default port is 3389. $ nohup VBoxHeadless -s mywiki -v on -p 3390 & Now if you want to check that your guest VM is among your running VMs $ VBoxManage list runningvms If you should need to connect to the console on that running VM named mywiki. Lets assume it’s IP address is 192.168.139.10. We are going to use rdesktop, which is a good RDP client found in most linux distros. $ rdesktop -g 1024x768 -a 16 -5 192.168.139.10:3390 & To view the properties of your VM use the showvminfo option. This is handy if you want to connect your RDP client to a running VM and you don’t remember which port your VM is listening on. $ VBoxManage showvminfo mywiki Ok, now lets assume you have a rogue guest- VM that want to shut-down and it is not responding to your request for a normal orderly shut-down. You can power it off using- $ VBoxManage contolvm mywiki poweroff For details see virtualbox site- https://www.virtualbox.org/manual/ch08.html https://www.virtualbox.org/manual/ch08.html $ vboxmanage import <file>.ova https://www.virtualbox.org/manual/ch08.html $ vboxmanage export <machine-name> -o <file>.ova https://www.virtualbox.org/manual/ch08.html $ vboxmanage clonevm <source-machine-name> --name <target-machine-name> --register Check running process and kill in case VM got stuck ps -AF | grep V Start Virtual machine VBoxManage startvm "VM name" --type headless For example: VBoxManage startvm ubuservloc --type headless Exporting and importing appliances In the case you do your backups using some sort of shell script, VBoxManage export (followed by the virtual machine name, can help you get the job done. The following command will export the CentOS7 appliance to ~/VMexports/CentOS7.ova: VBoxManage export CentOS7 --output ~/VMexports/CentOS7.ova To import it (not surprisingly), we will use VBoxManage import: VBoxManage import ~/VMexports/CentOS7.ova Resize Virtual Disk Size VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi VBoxManage modifyhd "cloned.vdi" --resize 51200 VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk Changing UUID in virtual disk VBoxManage internalcommands sethduuid "/home/user/VirtualBox VMs/drupal/drupal.vhd" List your VMS First list your available Virtual Machines with the command VBoxManage list vms, I illustrate this on my own setup: andrew@ilium~$ VBoxManage list vms "Windows 8" {c4422acd-727b-45a0-9eef-65636bcde44d} "Windows 10" {a8e262be-a032-4918-9085-63185318a979} "Trusty Tahr Clean Copy" {c99bcf4b-9fea-4971-b190-425cb0b0cdeb} "Xenial Xerus Clean Copy" {850122b9-c65f-425b-abb3-ffda68e159c6} "Precise Pangolin Clean Copy" {169086e6-a3f4-42e7-8a89-63dcb273143f} "Precise Pangolin Working Copy" {ff8312b6-cfae-4877-aa93-d71036d8882c} "Xenial Xerus for MPlayer" {44902710-4368-4c06-9d24-3cb55328d31c} "Xenial Xerus for vlc" {a62ad306-17d9-4ee3-8c1a-e4439c3b0e05} "Xenial Xerus mingw64" {584d8513-6a16-49c7-b020-d657b93d5552} "Trusty Tahr Working copy..." {433349e9-52eb-4066-bae7-623592871839} "Xenial Xerus Working copy..." {dda23e74-cdb5-4c7d-8836-31be4129c02a} andrew@ilium~$ Note: If you are unsure which VM is actually running you could use VBoxManage list runningvms Start a VM: The VBoxManage command and options that you are after to start a Virtual Machine are these: startvm <uuid|vmname>... [--type gui|sdl|headless|separate] So to start the “Trusty Tahr Clean Copy” VM in my example you would use: VBoxManage startvm "Trusty Tahr Clean Copy" --type gui Stop a VM: To stop the VM you would again use VBoxManage but this time with controlvm option: controlvm <uuid|vmname> pause|resume|reset|poweroff|savestate| And in my example to close the “Trusty Tahr Clean Copy” VM the command would be: VBoxManage controlvm "Trusty Tahr Clean Copy" savestate