以下是VirtualBox在Ubuntu上的命令行操作方法:
安装VirtualBox
sudo apt update  
sudo apt install virtualbox  
创建虚拟机
VBoxManage createvm --name "UbuntuVM" --ostype "Ubuntu_64" --register  
配置虚拟机
VBoxManage modifyvm "UbuntuVM" --memory 2048  
VBoxManage createhd --filename "UbuntuVM.vdi" --size 20000  
VBoxManage storagectl "UbuntuVM" --name "SATA Controller" --add sata --controller IntelAhci  
VBoxManage storageattach "UbuntuVM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "UbuntuVM.vdi"  
启动/关闭虚拟机
VBoxManage startvm "UbuntuVM"  
VBoxManage controlvm "UbuntuVM" poweroff  
其他常用操作
VBoxManage list vms  
VBoxManage unregistervm "UbuntuVM" --delete  
说明:需先安装VirtualBox扩展包以支持命令行工具VBoxManage,部分操作(如网络配置)需结合图形界面或额外参数。