By default, desktop versions of Ubuntu boot directly into a graphical user interface (GUI). However, if you are configuring a server, troubleshooting display driver issues, or trying to conserve system resources on older hardware, you may prefer to boot directly into a text-based command line environment. You can achieve this by modifying the systemd default target.
Why Disable the Ubuntu Graphical Interface?
Running a full desktop environment consumes significant RAM and CPU cycles. Disabling the GUI is highly beneficial when repurposing an old computer as a headless home server or when a faulty graphics driver is preventing the desktop from loading correctly. It allows you to interact with the system purely through the terminal, maximising performance for background services.
Step 1: Check Your Current Boot Target
Ubuntu uses systemd to manage the boot process. The boot modes are called “targets”. The graphical environment is the graphical.target, while the command line environment is the multi-user.target.
- Open a terminal window (Ctrl + Alt + T).
- Run the following command to see your current default boot target:
systemctl get-default
If you are using a desktop installation, this command will almost certainly return graphical.target.
Step 2: Change the Default Boot Target
To configure Ubuntu to bypass the display manager and boot straight into the terminal, you need to change the default target to multi-user.
- In the terminal, execute the following command:
sudo systemctl set-default multi-user.target
- You will be prompted to enter your administrator password.
- The system will output a message confirming that the default target symlink has been removed and replaced, pointing to
multi-user.target. - Restart your computer using the following command to test the changes:
sudo reboot
Upon rebooting, Ubuntu will stop at a black screen with a text-based login prompt. Enter your username and password to access the command line.
How to Restore the Graphical Interface
If you need to use the desktop interface temporarily without rebooting, you can start the GUI from the command line by typing:
sudo systemctl start graphical.target
If you want to permanently restore the GUI so that Ubuntu boots into the desktop normally on every startup, revert the systemd default target by running:
sudo systemctl set-default graphical.target
Managing your boot targets with systemd gives you complete control over how your Ubuntu system allocates its resources upon startup.