37

When passing "-curses" option to qemu, qemu displays the emulation window as default. So, how can I switch to the monitor console from the emulation window? If using graphical interface, switching between emulation window and monitor console can be achieved by "ctrl+alt+(1 or 2)". I am just not sure how to do this in the non-graphical case.

tshepang
  • 12,111
  • 21
  • 91
  • 136
pusam
  • 403
  • 1
  • 4
  • 5

5 Answers5

32

Just use Esc instead of Ctrl-Alt. So to switch to the monitor console use Esc+2. To switch back to the terminal output use Esc+1. You can similarly switch ptys with Esc+F2 etc.

fuzzyTew
  • 3,511
  • 29
  • 24
minipli
  • 321
  • 3
  • 3
  • Hi, the ESC+1 and ESC+2 worked great for me for years. But now that I upgraded my system and I'm using QEMU 4.2.0, those shortcuts for switching to the monitor and back don't work anymore. Any ideas? Note: Alt+1, Alt+2 still work, but I need to use ESC+1, ESC+2 to avoid conflicts with the other shortcuts of the terminal emulator. How can I re-enable ESC+1, ESC+2 ? – vvaltchev May 22 '20 at 11:50
28

From the section keys in the character backend multiplexer in the QEMU docs:

During emulation, if you are using a character backend multiplexer (which is the default if you are using -nographic) then several commands are available via an escape sequence. These key sequences all start with an escape character, which is Ctrl-a by default, but can be changed with -echr. The list below assumes you’re using the default.

Ctrl-a c

Rotate between the frontends connected to the multiplexer (usually this switches between the monitor and the console)

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
nikitis
  • 281
  • 3
  • 2
  • 1
    Beware that if you also use `-monitor` without `-serial mon:stdio`, QEMU disables this escape sequence: https://stackoverflow.com/questions/49716931/how-to-run-qemu-with-nographic-and-monitor-but-still-be-able-to-send-ctrlc-to/49751144#49751144 – Ciro Santilli OurBigBook.com Apr 11 '18 at 12:43
  • 1
    Linked documentation is unfortunately dead, wayback machine link: https://web.archive.org/web/20131223164110/http://wiki.qemu.org/download/qemu-doc.html#Keys Use `Ctrl+a`, `c` again to toggle back. – NiKiZe Jul 31 '21 at 14:02
15

Doesn't appear to be possible. However, you can access the monitor console via Telnet.

Start QEMU:

qemu-system-i386 -curses -monitor telnet:127.0.0.1:1234,server,nowait

Then, to access the monitor console, type this in another terminal:

telnet 127.0.0.1 1234
Søren Løvborg
  • 8,354
  • 2
  • 47
  • 40
  • 1
    `ctrl + a c` reported by nikitis seems to be better (you can see the boot process). – pevik Jan 22 '16 at 11:28
  • You likely also want `-serial mon:stdio`, otherwise Ctrl+C does not get passed to guest anymore due to `-monitor`: https://stackoverflow.com/questions/49716931/how-to-run-qemu-with-nographic-and-monitor-but-still-be-able-to-send-ctrlc-to/49751144#49751144 – Ciro Santilli OurBigBook.com Apr 11 '18 at 12:42
14

alt + 2

Just drop the 'ctrl' and all of the key sequences work as expected.

Undo
  • 25,519
  • 37
  • 106
  • 129
Anthony Liguori
  • 141
  • 1
  • 2
3

None of the above worked for me. I have Ubuntu 16.04, I don't think this matters.

Ctrl + Alt + 2 worked for me.

natcomp256
  • 706
  • 7
  • 13