To disable the GUI when not in use on Ubuntu 22.04, you can use the following commands:

Temporarily disable the GUI (without shutting down the system)

This is used to stop the GUI Desktop (GNOME/XFCE) while the server is still running


Permanently disable the GUI (not to start automatically)
To disable the GUI and boot into Command Line (CLI) mode only

multi-user.target mode is the mode without GUI
Restart the server for the settings to take effect

Re-enable the GUI
To re-enable the GUI

Then restart the system

Summary
Temporarily disable the GUI → sudo systemctl stop display-manager
Permanently disable the GUI (boot to CLI only) → sudo systemctl set-default multi-user.target
Re-enable the GUI → sudo systemctl set-default graphical.target

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate »