Why Disable the Graphical Interface?
Modern Linux desktop environments, such as GNOME (the default on Ubuntu) or KDE Plasma, are visually stunning and highly functional. However, drawing those beautiful drop-shadows, animations, and high-resolution icons requires a significant amount of system RAM and CPU cycles.
If you are repurposing an old, low-spec laptop into a dedicated home media server, a network-attached storage (NAS) device, or a Pi-hole DNS ad blocker, every megabyte of RAM counts. Because these server applications run entirely in the background and are managed remotely via SSH or a web browser, having the graphical user interface (GUI) rendering on the screen 24/7 is a massive waste of system resources.
Fortunately, you do not need to uninstall Ubuntu Desktop and completely reinstall Ubuntu Server to fix this. You can easily instruct Ubuntu to boot directly into a pure text-based command-line interface (CLI) by default, completely bypassing the heavy graphical environment.
The Modern Method: Using systemd Targets
In the past, Linux users accomplished this by editing the GRUB bootloader configuration files. While that method still works, it is largely outdated. Modern Ubuntu (and most other major Linux distributions) uses systemd to manage the boot process. Systemd uses "targets" to determine what state the operating system should boot into.
- graphical.target: Boots the OS, starts the network, and launches the full graphical desktop environment (Runlevel 5).
- multi-user.target: Boots the OS, starts the network, and drops you at a text-based login prompt with no GUI (Runlevel 3).
To disable the GUI, you simply need to tell systemd to use the multi-user.target as the default.
How to Disable the GUI on Boot
To make this change, you will need to open a terminal. You can do this from within your existing graphical desktop.
- Open the Terminal application (press
Ctrl + Alt + T). - Type the following command exactly as written:
sudo systemctl set-default multi-user.target - Press Enter. Because you are using
sudo, you will be prompted to type your administrator password. The characters will remain invisible as you type them.
The terminal will output a message confirming that a symbolic link has been removed and a new one has been created, pointing the default boot process to the multi-user target.
The next time you reboot the computer, you will not see the Ubuntu login screen or your desktop wallpaper. Instead, the screen will remain black, and you will see a simple text prompt asking for your login: and password:. The system is fully operational, connected to the internet, and running all your server applications in the background, but the RAM-heavy GUI is completely disabled.
How to Temporarily Launch the GUI
What if you disabled the GUI to save RAM, but you suddenly need to use a graphical tool (like GParted) to format a hard drive? You do not need to permanently re-enable the GUI just for one task.
If you are staring at the text-based command-line prompt, simply log in with your username and password, and type:
startx
Press Enter. (On some systems, depending on your display manager, you may need to type sudo systemctl start gdm3 instead). The graphical desktop will instantly load. Once you are finished, you can simply restart the computer, and it will boot back into the lightweight text-only mode.
How to Re-Enable the GUI Permanently
If you decide you no longer want to use the computer as a headless server and want to use it as a normal desktop PC again, reversing the process is just as easy as setting it.
- Log into the text-based command prompt.
- Type the following command to restore the default graphical target:
sudo systemctl set-default graphical.target - Press Enter.
- Type
sudo rebootto restart the machine.
Upon reboot, the standard, fully-featured Ubuntu graphical login screen will return.