Here is command to run from CLI to get ifconfig
output on guest machine (with ubuntu server):
vboxmanage guestcontrol <vm name> run --exe '/sbin/ifconfig' --username <username> --password <pass>
You can write shell function to simplify the call:
function vbox-get-ip() {
if [ -z $1 ]; then
echo "pass VM name"
return
fi
vboxmanage guestcontrol $1 run --exe '/sbin/ifconfig' --username <username> --password <pass>
}
Sure you can execute other commands on the host. Just make sure you pass full path to the binary.