VirtualBox get IP of VM (cli)

Here is command to run from CLI to get ifconfig output on guest machine (with ubuntu server):

vboxmanage guestcontrol  run --exe '/sbin/ifconfig' --username  --password 

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  --password 
}

Sure you can execute other commands on the host. Just make sure you pass full path to the binary.

Proxy Information
Original URL
gemini://g.codelearn.me/2018-02-18-run-commands-on-guest-vm.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
531.709533 milliseconds
Gemini-to-HTML Time
0.134164 milliseconds

This content has been proxied by September (ba2dc).