If you use Linux you’re probably familiar with the CLI (Command Line Interface) and a GUI (Graphical User Interface, but you can also change between CLI and GUI mode. With a simple terminal command, you can change between CLI and GUI mode at will.
Now, this isn’t talking about switching to a TTY. That’s another option and you can switch between them just as easily, perhaps even easier. I think I’ll touch on TTY first.
TTY stands for Teletype with origins back when teletype terminals were how you interacted with a computer. There’s still some use for TTY, typically when the GUI has issues responding (at least at my house).
If you want to visit the TTY, read all these directions.
Let’s enter tty3. Press
Congratulations, you’re in tty mode. You can log in and run commands. The output of such will appear on your screen.
Now you’re stuck. This is why you read the directions first.
Most often, you can press
If that doesn’t work, press
That’s all well and good, but we’ll be showing you how to change between CLI and GUI mode with init and changing your runlevel.
You’ll need an open terminal for this. You can usually press
With your terminal open, you can check your current runlevel. To do that, you just run runlevel in the terminal. If you do so, you’ll likely find out that your runlevel is 5, which is where it should be as my readers are generally GUI desktop users. It looks like this:
If the output is a 3, you’re in CLI mode.
Change Between CLI And GUI Mode:
By keeping that terminal open AND reading the directions before acting on this information, we can start switching between CLI and GUI modes. You want to read all the directions so that you don’t get stuck so that you’re able to find your way back to the GUI mode.
Very simply, 3 is CLI and 5 is GUI. Got it?
If you’re in a CLI mode (and a GUI is available) you can switch to the GUI mode with the following command:
sudo init 5
If you’re in a GUI mode and you want to switch to a CLI mode, the command is just as simple. You just need to change the value, like so:
sudo init 3
That’s all you need to know if you want to change between CLI and GUI mode. It’s not very complicated, though you should make sure you know how to return to the previous mode so that you’re not stuck and need to reboot your computer to return to your more comfortable GUI mode.
Well, that’s a short article!
Ha, just kidding!
Change Between CLI And GUI Mode (With systemd):
Most users can be assumed to be using systemd at this point. If you’re not sure if you’re using systemd, you can run the following command:
ps -p 1 -o comm=
If you’re using systemd, the output should look like this:
kgiii@kgiii:~$ ps -p 1 -o comm=
Now, you can use systemd to change between CLI and GUI mode. To ensure you can return to a GUI mode after running this command, you should probably read the entire directions for doing this with systemd.
If you’re in CLI mode and you wish to switch to a GUI mode (again, assuming such is available – which it may not be on servers), the command is quite simple. Just run:
sudo systemctl isolate graphical.target
If you’re in GUI mode and you want to switch to CLI mode, the command is quite similar. That command looks like this:
sudo systemctl isolate multi-user.target
See that? There’s a way to change between CLI and GUI mode with systemd and it’s quite an easy task. These commands are easy enough to remember, though you could always add them to your handy notes so that you have these commands available when you can’t recall them off the top of your head.
There are times when a GUI is better than a CLI. There are times when a CLI is better than a GUI. Then, for example, there are times when a full screen of text is better than just using a terminal. If you’re processing a lot in the terminal, using a full-screen CLI isn’t necessarily a bad idea. You’d certainly not be alone in doing so.
I expected to split this into two different articles, but I decided to add the bit about systemd to this article as it was simply too short without it. I’ve been trying to ensure my articles are 800+ words, more often than not, and folks seem to appreciate the longer articles with more information.
This site has been and always will be, a work in progress. I learn and grow as I write these articles. This is reflected by the changes I make along the way. I’m sure that I’ll continue to grow for as long as I write these articles. I’m equally sure that things will change as time passes.
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.