Switching between virtual console and GUI
How to switch between virtual console and GUI in Ubuntu? I wanted to see what key functions would allow me to switch between the two.
By default Ubuntu has 6 virtual consoles tty1-tty6 which are accessed by the keyboard combinations Ctrl+Alt+F1 to Ctrl+Alt+F6. The virtual console can also be accessed from a black screen if the boot process stops at a black screen when booting. To access the GUI from any virtual console press the keyboard combination Ctrl+Alt+F7.
Starting with Ubuntu 17.10 the virtual consoles are accessed by the keyboard combinations Ctrl+Alt+F3 to Ctrl+Alt+F6. To access the GUI from any virtual console press the keyboard combination Ctrl+Alt+F2.
To login from a virtual console:
At the
login:
prompt type your username and press Enter.At the
Password:
prompt type your user password and press Enter. After you have logged in, you can run commands from the virtual console.-
To bring up the normal Ubuntu login screen run this command:
sudo systemctl start lightdm.service
In 16.04 and later run this command instead to bring up the normal Ubuntu login screen:
sudo systemctl start graphical.target
New answer, for the sake of readability, and for additional info:
Key combination
You always need to use these keys pressed together.
On normal installations:
It's Ctrl + Alt + one of the function keys.
When used within a VirtualBox virtual machine:
(Unless you configured VirtualBox otherwise,) it's Right Ctrl + one of the function keys.
Which function key leads where
On GDM3:
Recent stock Ubuntu releases (with Gnome 3 desktop) (e.g. 17.10 — 20.04 (and probably later)) come with the GDM3 display manager. If you have not altered the display manager yourself, then you have GDM3.
F1: The GDM (purple) login screen.
F2: The graphical session (where you usually want to be)
F3 - F6: virtual consoles / TTYs
F7: Unstable, largely unusable, unaccounted for; avoid it
On LightDM:
Non-Gnome Ubuntu releases often ship with the LightDM display manager. (Or maybe you have switched to LightDM by choice.)
F1 - F6: Virtual consoles / TTYs
F7: The graphical session (where you usually want to be)
(This is the behavior how all major display managers behaved before 2017, therefore you will see a lot of guidance that refers to this key assignment. Also, GDM3's new key assignment (discussed above) still catches a lot of non-Gnome users unaware, and they will still suggest using the traditional (now LightDM-only) pattern.)