10

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.

karel
  • 114,770

2 Answers2

17

In Ubuntu 17.10 and later 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.


In Ubuntu 17.04 and earlier Ubuntu has 6 virtual consoles tty1-tty6 by default 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.

To login from a virtual console:

  1. At the login: prompt type your username and press Enter.

  2. At the Password: prompt type your user password and press Enter. After you have logged in, you can run commands from the virtual console.

  3. To bring up the normal Ubuntu login screen in Ubuntu 16.04 and later run this command:

    sudo systemctl start graphical.target
    

    To bring up the normal Ubuntu login screen in Ubuntu 15.10 and earlier run this command:

    sudo systemctl start lightdm.service  
    
karel
  • 114,770
  • In Ubuntu 17.10 and later, tty1 (accessed by Ctrl+Alt+F1) contains the login screen, and tty2 (accessed by Ctrl+Alt+F2) contains your actual loaded graphical session. – karel Jun 21 '18 at 11:20
  • It is even possible to login twice on tty1. Then the first GUI is on tty2 and the second on tty3 (or whatever is the next available one). – PerlDuck Jul 08 '19 at 17:02
  • its is not working for me. If press Ctrl+Alt+F1 , getting (getting all possibilities ) – GNK Dec 12 '20 at 10:48
  • Ctrl+Alt+F3 also not working. – GNK Dec 12 '20 at 10:57
4

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.)

Levente
  • 3,961