25

After I press ctrl + alt + f4 the virtual terminal appears but I can't exit anymore because it is always back to "input username" and "password". Any idea how to go back to my desktop?

Hizqeel
  • 1,895
Kerth G.
  • 281
  • 2
    In Ubuntu 18.04 Bionic Beaver the login screen now uses virtual terminal 1 instead of virtual terminal 7 – Arun Jun 28 '18 at 06:32

4 Answers4

23

@Kerth G. if you press these buttons: Ctrl+Alt+(F1 to F6), you will get TTY, to exit from that you have two ways:

  1. Press Ctrl+Alt+F7, if you have function keys enabled press Ctrl+Alt+Fn+F7.
  2. Log into TTY with your user credentials, then in TTY type command: init 5, press Enter, now you will get Graphical User Interface.
  • 2
    In my case with function keys I had to Ctrl+Alt+Fn+F1 to switch to terminal. But then to go back I had to Ctrl+Alt+F7, withouth Fn! – tokosh Aug 24 '16 at 15:37
  • 1
    Note that on Gnome the GUI could be on TTY2. – Nonny Moose Jun 28 '18 at 13:52
  • 1
    And if you want to exit tty first type exit or press Ctrl+D to logout. Afterwards in ubuntu the GUI can be found with Ctrl+Alt+F2. – abu_bua Jun 28 '18 at 15:05
7

To log out of a virtual console, you need to type exit.

Your Desktop Environment will be started in one of the virtual terminals. On Ubuntu, it is on tty7. So to get to it, press Ctrl + Alt + F7 (F2 since 17.10).

Pablo Bianchi
  • 15,657
daltonfury42
  • 5,499
  • oh yeah it works, thanks dude but can i ask something? what is the use of virtual terminals? – Kerth G. Aug 08 '15 at 05:00
  • 1
    @KerthG. It's beautifully explained here. Also, if I solved your issue, please mark it as an answer. – daltonfury42 Aug 08 '15 at 05:02
  • @KerthG. If you think more about it, actually there are only virtual terminals. In one of the virtual terminals, you run your desktop. In servers, for example, there is no GUI, and all the user had are a set of virtual terminals/consoles. He could switch between terminals and run commands. What you do when you type some commands from the GUI is to open a terminal emulator, which runs four command on the shell. – daltonfury42 Aug 08 '15 at 05:14
  • 2
    @KerthG. To add to his point, the vterms are not created and destroyed as you switch among them; they are always there unless you go out of your way to remove them. Additionally, a simple use case is if your desktop is hanging because of firefox or something and you want to use a vterm to kill it. You can also use it to log in as another user to perform some CLI commands while leaving the desktop session open. – MGodby Aug 08 '15 at 05:49
  • @KerthG. to answer your question about the use of virtual terminals: Unix/Linux systems are originally have been build that way. Long time ago, when computers just were developed , everything was command-line, there was no GUI. And when GUI appeared , it was optional and took a lot of memory to run. Remember MS-DOS ? That's the origin of Windows. Linux/Unix Servers ? command line, unless you explicitly install some form of graphical interface. That's the real way computers work – Sergiy Kolodyazhnyy Aug 08 '15 at 06:00
  • 1
    yah, now i understand how the vterminal works so it means its like DOS command in windows. This is my first time to switch ni linux OS so I think I need to learn some keywords and command. By the way thanks for very informative answer. I appreciate it @MGodby I thinks someday I gonna master Ubuntu and other linux base OS – Kerth G. Aug 08 '15 at 08:52
5

Usually one virtual terminal (1 and 2, or 7) are reserved for the graphical environment, so to come out of a virtual terminal either try CTRL + ALT + F2 (F1 for login screen) or CTRL + ALT + F7.

Pablo Bianchi
  • 15,657
4

I tried all the other answers here, and none worked for me (Ubuntu VM)

To fix it, I logged in with my credentials and typed init 6 and chose to load the Ubuntu OS.

Zanna
  • 70,465