Not exactly what you ask, because you don't have a new real window or tab.
You can start screen
on the server (if available), so that you can multiplex your server sessions.
After that you have still a single screen
window, but if you do Ctrl+a c, you create a new screen
window, and switch between the windows with Ctrl+a 0, Ctrl+a 1.
You have the added advantage that you can disconnect from the server leaving the two (or more) sessions alive (Ctrl+a d), then restore them later (screen -dr
).
In qemu
/kvm
, you only get a GUI if you attach a video card to your VM and if you don't expose it as SPICE/VNC.
For instance, you can do (zsh
syntax, with grub2
):
grub-mkimage -O i386-pc -c =(print -l serial 'terminal_input serial' \
'terminal_output serial'
) -o grub.img configfile biosdisk part_msdos part_gpt ext2 \
linux test serial halt minicmd cat
And start your VM with:
kvm -kernel grub.img -hda yourdisk.img -nographic
From the grub
prompt, load the kernel from the disk passing console=ttyS0
... option or equivalent on the system you're booting to have the console on serial. Remember to add a getty on the serial line as well.
Assuming you're running Linux in the VM, you can then update its grub config to display on serial and boot a kernel with serial console, and then you can boot your image disk directly without that grub.img.
To access the qemu "monitor", type Ctrl-Ac (where you can add/remove devices...).
You can have the serial
port as a unix domain or TCP socket, instead of stdio
if you like as well. Same for the qemu "monitor" interface.
Now, provided you have the sgabios.bin
firmware, and that your VM doesn't use graphics (just VGA BIOS text output), you can also just use the -curses
option:
kvm -hda yourdisk -curses
The VGA console is then shown in your terminal. If you need to access the qemu monitor, press Alt-2.
Best Answer
Assuming that you're using X.org, this doesn't seem to be possible. The X server supports an option called
-novtswitch
but that only applies when the X server exits, not when it starts. Given the discussion in Fedora bug #246267, it seems that this option also applied when starting, but this was removed because it caused the X server to crash on a lot of hardware: the X server needs to access the video hardware when it starts.The next best thing would be to allow a short flicker to another vt and switch back. On Linux, you can use
openvt
to run a command in a new virtual terminal andchvt
to change back.Create a script
~/.xinitrc.chvt
containingand run
(The separate script
~/.xinitrc.chvt
as opposed tosh -c …
is needed becausestartx
messes up arguments containing wildcards, and you need to pass the absolute path due to another quirk of startx. Alternatively, callxinit
directly and set upXAUTHORITY
on your own.)Depending on where you're running this script, you may not have the permission to run
fgconsole
(“Couldn't get a file descriptor referring to the console”), because it needs to be able to open/dev/console
and it can't do that if some other user (root, in practice) owns it. I don't know how to find out how to return to the original console otherwise. One solution, if you have root access, would be to replaceORIGINAL_FGCONSOLE=$(fgconsole) …
byand give your account the permission to run
fgconsole
as root by runningvisudo
and adding the lineafter any other line that applies to your account. It's safe barring a bug in the
fgconsole
program.¹ If you're using Linux you're using X.org, and if you aren't using Linux there's still a good change that you're using X.org.