Score:0

How do I exit the Gui, and return to a plain command line shell?

fr flag

I installed ubuntu server 20.04 on a VM; Then i tried $ startx but it said X could not be found, so i installed it;

$ sudo apt install xinit

Now every time it boots, i get the GNOME Gui (gdm3);

How do I exit the Gui, and back into a plain shell?

What I tried didn't work:

$ sudo service gdm3 stop

, this does exit the GUI into a black screen, no $ prompt; (just a blinking cursor, looks hanged, so after 5 mins I just re-booted the VM)

frippe avatar
ug flag
You're looking for a tty: https://askubuntu.com/a/66198/1474576
fr flag
@frippe appreciate your comment, it worked ! but i accepted the other long explanation below.
Score:0
ma flag

Ctrl-Alt-F2 should drop you in a text console. Ctrl-Alt-F1 to get back to X11.

Also sudo init 3 is the traditional way to get out of X11, I'm not entirely sure if it still works nowadays.

Score:0
cn flag
raj

The text shell works in parallel with the GUI. Ubuntu (basically almost any Linux distro) uses 7 virtual terminals (VTs), accessible by pressing Ctrl+Alt+F1 to Ctrl+Alt+F7 (if you are on a text terminal, you can skip Ctrl and press Alt+F1 to Alt+F7 only).

Traditionally, VTs 1 to 6 were text terminals, while VT 7 was reserved for X. In new Ubuntu versions, however, this is different. GDM runs on VT 1. If you actually login to GNOME session via GDM, that session runs on VT 2. VT 7 displays some messages from system boot-up. So VT 3 to VT 6 can be used as text terminals.

So if you are on GDM or GNOME screen, pressing Ctrl+Alt+F3 to Ctrl+Alt+F6 should switch you to one of the text terminals available. Pressing Ctrl+Alt+F1 (or just Alt+F1) will bring you back to GDM screen, and pressing Ctrl+Alt+F2 (or Alt+F2) - to GNOME screen.

fr flag
Thanks for the long explanation; what is the purpose of GDM (Ctrl+Alt+F1), it just shows me a locked GUI; Ctrl+Alt+F2 is more useful, it's the GNOME screen that I get after I logged on.
raj avatar
cn flag
raj
Returning to GDM you can login to another user; it will start a new GUI on a new terminal.
Score:0
tr flag

As far as the fundamental question "How do I exit the Gui, and back into a plain shell?"

The 2nd part of dargaud's answer: "sudo init 3" bit is the correct answer to the question of how to quit X back to the console. Ctrl+Alt+F(whatever) are just switching to different consoles and will not shut down X. I've had to do it switching X drivers from generic to Nvidia proprietary, as I was unable to do it with X running.

And it still works fine on my up-to-date Ubuntu v20.04 LTS - Dec. 1st, 2021

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.