33

I just jumped into a command line virtual console using Ctrl-Alt-F1, and i would now like to return to the gui. startx gives me something along the lines of 'this server is already active for display 0' if ...etc. it gives me a command to remove /tmp/.X0lock if that isn't the case...I could just restart the machine, but i'm worried i might mess something up.

Jorge Castro
  • 71,754

2 Answers2

39

If you switched TTYs with Ctrl+Alt+F1 you can go back to the one running your X with Ctrl+Alt+F7.

TTY 7 is where Ubuntu keeps the graphical interface running.

Its not scary at all, you can use TTYs to do troubleshooting and other necessary configuration, get a bit familiar with it, login, check it out (it works as the terminal inside graphical Ubuntu) and logoff. You can login to several TTYs without messing your system.

When you want to go back to graphical press Ctrl+Alt+F7.


From 17.10 onwards VT1 is used for the display manager ("login screen"), the standard X session uses VT2. Hence we have VT3 as the first usable VT.

Also see Why is my GDM at a different TTY than my desktop environment? for more about the origin of this change.

Pablo Bianchi
  • 15,657
Bruno Pereira
  • 73,643
  • 1
    For me, Ctrl-Alt-F7 gives a bunch of information about VirtualBox. It's Ctrl-Alt-F8 that takes me back to X. – zondo Dec 14 '16 at 02:02
  • I will also just add this comment (by Hayden Schiff) made for a duplicate question (https://askubuntu.com/questions/547290/how-do-i-get-out-of-ctrl-alt-f3/547292) since it helped me:

    Footnote: I know this is an Ubuntu forum, but for any Fedora users who end up here -- you wanna switch to VT2, not VT7: Ctrl+Alt+F2.

    (So it seems that if F7 doesn't work for you maybe it is a good idea to keep trying different F's until you hit the GUI).

    – Kvothe Apr 03 '18 at 14:35
  • For me on Ubuntu 22.04 it was Ctrl+Alt+F2 – ggorlen Jul 31 '23 at 04:11
0

I had just tried to open a Virtual Terminal on my Ubuntu 20.04, and my login screen seem to have frozen instead since then. After banging various keys, I just tried to use Ctrl+Alt+Delete key combination which saved me from forceful shutdown using system Power Key press for long. Sharing this alternative as an alternative to above combination in case anyone faces this issue.