Change Between CLI and GUI Mode

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:

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 CTRL + ALT + F3.

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 CTRL + ALT + F7 to return to the desktop.

If that doesn’t work, press CTRL + ALT + and keep pressing over and over again until you return to a graphical environment. As this is not standardized, you may need to press various combinations of the CTRL + ALTFunction Keys or even the back arrow button. No, I do not know why this isn’t standardized.

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.

Runlevel:

You’ll need an open terminal for this. You can usually press CTRL + ALT + T to open your default terminal.

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:

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:

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:

If you’re using systemd, the output should look like this:

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:

If you’re in GUI mode and you want to switch to CLI mode, the command is quite similar. That command looks like this:

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.

Closure:

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.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.