Open In App

How to switch between the CLI and GUI on a Linux server

Last Updated : 29 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The command line interface (CLI) is the text-based way to interact with Linux using keyboard commands. The graphical user interface (GUI) provides a visual desktop with icons and graphics to manage the system. Linux allows smooth transitioning between CLI and GUI. You can access the keyboard-driven terminal or the graphical desktop on the same Linux machine. Different key combinations are used to shift from one interface to the other without losing your workflow.

What is CLI?

The CLI ( Command Line Interface ) allows controlling programs by typing text commands instead of clicking graphics. It gives text-based access to operating systems through a terminal. The CLI runs programs and returns text output. It provides precise control over applications and systems though requires learning commands. Expert users often choose the CLI for its productivity over graphical clicks. It underlies the workings of all operating systems.

What is GUI?

The GUI ( Graphical User Interface ) provides a visual way to interact with computers using graphics, icons, menus, and a pointing device. It allows clicking buttons and selecting items from the screen rather than needing to type text commands. GUIs enable intuitive point-and-click interaction with programs and systems. They provide easy access to applications through visual elements rather than typing commands on a command line. The GUI makes computers more user-friendly. It is the most common way modern users engage with personal computing devices and software.

What is a Linux Server?

A Linux server refers to a computer system that runs a Linux-based operating system and is configured to provide various services, resources, or applications to other computers on a network. Linux is a popular open-source Unix-like operating system kernel, and there are many distributions (distros) that package the Linux kernel with supporting system software and libraries to create complete operating systems.

How to switch between the CLI and GUI on a Linux server

In this section, we will see two different methods to switch between the CLI and GUI on a Linux server. Below we have listed both possible methods.

  • Method 1: Using Keyboard Shortcut
  • Method 2: Using Init Runlevels

Let’s explore each of the methods in detailed step-by-step implementation.

Method 1: Using Keyboard Shortcut

Step 1: Switch Between GUI to CLI

Press Ctrl + Alt + F1 to switch from the Graphical User Interface (GUI) to the Command Line Interface (CLI) in Linux. This keyboard shortcut takes you to the first virtual terminal, allowing you to access the command line.

Key: Ctrl + Alt + F1
Switch between GUI to CLI

Switch between GUI to CLI

This keyboard shortcut (Ctrl + Alt + F1) exits the graphical desktop environment and brings you to a text login prompt on the first virtual terminal.

Step 2: Switch Between CLI to GUI

To switch from the Command Line Interface (CLI) to the Graphical User Interface (GUI) in Linux, press Alt + F7. This keyboard shortcut takes you back to the original virtual terminal where the GUI is running.

Key: Alt + F7
Switch between CLI to GUI

Switch between CLI to GUI

Method 2: Using Init Runlevels

Step 1: Switch Between GUI to CLI

To switch from the Graphical User Interface (GUI) to the Command Line Interface (CLI) in Linux, run the following command in your active terminal :

systemctl isolate multi-user.target

This command exits the graphical desktop environment, placing you directly at the text login prompt, ready to access the CLI terminal

Switching the GUI mode to CLI mode

Switching the GUI mode to CLI mode

Once we execute the above Runlevels command, the GUI interface is been switched to the CLI in Linux.

CLI Interface

CLI Interface

Step 2: Switch Between CLI to GUI

Before you can switch back to the Graphical User Interface (GUI) desktop from the Command Line Interface (CLI) terminal, you need to be logged into your Linux operating system in the CLI with your user credentials.

Linux System Login Credentials

Linux System Login Credentials

The below command is used to transition from the Command Line Interface (CLI) to the Graphical User Interface (GUI) desktop in Linux. This command isolates the graphical target, effectively switching the system from the text-based CLI mode to the GUI environment. Once executed, it brings up the graphical desktop interface, providing a user-friendly environment for interaction with the Linux desktop environment and applications.

systemctl isolate graphical.target
Switching the CLI mode to GUI mode

Switching the CLI mode to GUI mode

Conclusion

In conclusion, the command line interface (CLI) allows controlling the computer by typing text commands in a terminal, while the graphical user interface (GUI) provides easy visual access through icons and menus. The CLI offers more flexibility and control while the GUI promotes intuitive interaction. Linux systems provide both interfaces – the powerful text-based CLI underneath and the user-friendly graphical desktop on top. Users can switch between them to harness the strengths of both as per their needs and comfort. While the GUI makes things easier, understanding the CLI gives deeper access and control.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads