Switching Linux terminals in VirtualBox using VBoxManage

Quick tip to switch terminals in a Linux VM running on top of VirtualBox. The following commands send the keyboard combo Control+Alt+FX (where FX is F1,F2,F3,…) to the specified VM, so you can switch from graphical desktop to terminal 1, 2, etc. Open a terminal and type:
VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 3b 
(Equivalent to Ctrl-Alt-F1)

VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 3c 
(Equivalent to Ctrl-Alt-F2)

VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 3d 
(Equivalent to Ctrl-Alt-F3)

VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 3e 
(Equivalent to Ctrl-Alt-F4)

VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 3f 
(Equivalent to Ctrl-Alt-F5)

VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 40 
(Equivalent to Ctrl-Alt-F6)

VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 41 
(Equivalent to Ctrl-Alt-F7)

VBoxManage controlvm my-linux-vm-name keyboardputscancode 1d 38 42 
(Equivalent to Ctrl-Alt-F8)
See Linux keyboard scancodes

3 Responses to 'Switching Linux terminals in VirtualBox using VBoxManage'

  1. Jason says:

    Handy Tip! Thanks

  2. ace says:

    Yes, that works but it’s pretty useless as I now can’t enter anything in from my keyboard!

  3. eart says:

    You can also use right ctrl+Fx.
    I think right ctrl substitutes ctrl+alt in vbox.

Leave a Reply

Your email address will not be published. Required fields are marked *

*